现在的位置: 首页 > 综合 > 正文

Github使用1-入门

2014年02月05日 ⁄ 综合 ⁄ 共 1427字 ⁄ 字号 评论关闭

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

Github的入门使用流程:

1、注册github帐号。

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

点击进入后得到其地址:

https://github.com/Thinkerfans/GitTest

3、安装git 工具。(linux系统上)

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

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fans@yuan:src$ git config  --global user.email "2656079093@qq.com"
fans@yuan:src$ git config --global user.name "thinker"

此邮件和用户名就是你gitHub上Profile里面的用户名和邮箱号。

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

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

fans@yuan:gitspace$ git init
Initialized empty Git repository in /home/fans/gitspace/.git/

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

fans@yuan:gitspace$ git clone https://github.com/Thinkerfans/GitTest
Cloning into 'GitTest'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
fans@yuan:gitspace$ ls
GitTest

8、本地编辑后同步到gitHub上的步骤:

fans@yuan:GitTest$ vim test.c
fans@yuan:GitTest$ 
fans@yuan:GitTest$ 
fans@yuan:GitTest$ ls
README.md  test.c
fans@yuan:GitTest$ git add test.c
fans@yuan:GitTest$ git commit -m "add test.c file"
[master 107f2db] add test.c file
 1 file changed, 4 insertions(+)
 create mode 100644 test.c
fans@yuan:GitTest$ git pu
pull   push   
fans@yuan:GitTest$ git push 
Username for 'https://github.com': Thinkerfans
Password for 'https://Thinkerfans@github.com': 
To https://github.com/Thinkerfans/GitTest
   1b0439b..107f2db  master -> master

查看gitHub上是否已经有test.c这个文件。

【上篇】
【下篇】

抱歉!评论已关闭.