Github使用1-入门

来源:互联网 发布:java十个数输出最小值 编辑:程序博客网 时间:2024/06/06 14:02

Gighub官网:https://github.com/

Github的入门使用流程:

1、注册github帐号。

2、登陆帐号后创建一个repository。如命名为:GitTest

点击进入后得到其地址:

https://github.com/Thinkerfans/GitTest

3、安装Git 工具。(Linux系统上)

4、将gitHub上帐号绑定到git工具上。若不绑定,当你执行git commit  是报如下错误。

[java] view plain copy
  1. *** Please tell me who you are.  
  2.   
  3. Run  
  4.   
  5.   git config --global user.email "you@example.com"  
  6.   git config --global user.name "Your Name"  
  7.   
  8. to set your account's default identity.  
  9. Omit --global to set the identity only in this repository.  
  10.   
  11. fans@yuan:src$ git config  --global user.email "2656079093@qq.com"  
  12. fans@yuan:src$ git config --global user.name "thinker"  
此邮件和用户名就是你gitHub上Profile里面的用户名和邮箱号。


5、在本地电脑上创建一个文件夹,如:gitspace

6、转到此目录下,执行git init

[java] view plain copy
  1. fans@yuan:gitspace$ git init  
  2. Initialized empty Git repository in /home/fans/gitspace/.git/  

7、将github上创建的仓库GitTest拷贝到gitspaces目录下

[java] view plain copy
  1. fans@yuan:gitspace$ git clone https://github.com/Thinkerfans/GitTest  
  2. Cloning into 'GitTest'...  
  3. remote: Counting objects: 3, done.  
  4. remote: Total 3 (delta 0), reused 0 (delta 0)  
  5. Unpacking objects: 100% (3/3), done.  
  6. fans@yuan:gitspace$ ls  
  7. GitTest  

8、本地编辑后同步到gitHub上的步骤:
[java] view plain copy
  1. fans@yuan:GitTest$ vim test.c  
  2. fans@yuan:GitTest$   
  3. fans@yuan:GitTest$   
  4. fans@yuan:GitTest$ ls  
  5. README.md  test.c  
  6. fans@yuan:GitTest$ git add test.c  
  7. fans@yuan:GitTest$ git commit -m "add test.c file"  
  8. [master 107f2db] add test.c file  
  9.  1 file changed, 4 insertions(+)  
  10.  create mode 100644 test.c  
  11. fans@yuan:GitTest$ git pu  
  12. pull   push     
  13. fans@yuan:GitTest$ git push   
  14. Username for 'https://github.com': Thinkerfans  
  15. Password for 'https://Thinkerfans@github.com':   
  16. To https://github.com/Thinkerfans/GitTest  
  17.    1b0439b..107f2db  master -> master  
查看gitHub上是否已经有test.c这个文件。

来源:http://blog.csdn.net/sunnyfans/article/details/17199507

原创粉丝点击