码迷,mamicode.com
首页 > 其他好文 > 详细

GitHub使用教程

时间:2014-05-16 01:25:37      阅读:317      评论:0      收藏:0      [点我收藏+]

标签:github   版本控制系统   git   

Step1:

在GitHub上创建一个测试用的项目:https://github.com/JOJOZHANGJU/testgithub.git

这个项目已经在github.com上创建好,名字叫做testgithub.git

Step2:

转到自己的工作目录:

例如:githabtest

注:最好勾选上初始化一个readme文件

cd githabtest/

Step3:

创建并下载相关项目:

git clone git@github.com:JOJOZHANGJU/test.git

可能会遇到permission denied publickey的问题:

solution:

cat ~/.ssh/id_rsa.pub

复制密钥之后在github上添加ssh密钥即可

Step4:

进入目录看看:

cd test

Step5:

查看主枝和分支。登录GitHub.com,加入项目后,在项目里的Network有图形化的分支图

git show-branch
[master] Initial commit

Step6:

建立项目远程地址

git remote add origin git@gitbub.com:JOJOZHANGJU/test.git

Step7:

建立自己的分支或者使用当前分支都可以,下面介绍建立自己的分支

git branch your_branch_name

Step8:

再看看有哪些分支

git show-branch

Step9:

查看现在使用的分支

git branch

*表示当前使用的分支

Step10:

进入自己的分支:

git checkout your_branch_name

Step11:

添加、修改些东西,something代表你要修改的文件,或者新建一个文件都可以

touch test.txt
echo "HELLO WORLD">test.txt

Step12:

把文件加入到跟踪(注:每次提交前必须要这步)

git add test.txt

Step13:

提交修改(提交到本地,还没有传到服务器)

git commit -m '说明'

Step14:

提交分支到服务器

git push origin your_branch_name

Step15:

获得最新的项目文件(从服务器下载)

git pull git://github.com/JOJOZHANGJU/test.git JOJO






GitHub使用教程,布布扣,bubuko.com

GitHub使用教程

标签:github   版本控制系统   git   

原文地址:http://blog.csdn.net/jojozhangju/article/details/25922615

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!