linux下git与github简单使用
个人觉得github蛮好用,但是帮助系统还是不够人性化,东一句西一句,让新手看着头晕。所以稍稍整理下主要的步骤。
首先是在github上创建一个账户:luozhaoyu
然后我个人的主页就是github.com/luozhaoyu了。
然后在github上创建一个test仓库,进行基本配置后需要在test仓库中添加可以提交代码的电脑的公钥。
这个公钥怎么生成呢?这就要转到我们PC这一边进行设定了。
在linux上有一个ssh-keygen的工具,使用命令
ssh-keygen -t rsa -C "committer_email@committermail.com"
ssh -T git@github.com
apt-get install git
git config --global user.name 'The Name'git config --global user.email anyemail@mail.com
[user] >---name = LZY under Ubuntu with Hasee>---email = luozhaoyu90@gmail.com这里应该是随便配置用户名和邮箱都可以,这个事方便大家联系
git init
git add *
git commit -m 'your comment'
git remote add origin git@github.com:luozhaoyu/test.git
git push origin master
git clone git://github.com/luozhaoyu/test.git
git pull
git branch查看现在所在的branch分支
git branch newbranchname创建一个新分支
git checkout branchname切换到其它分支OOXX