设置git的user name和email:
$ git config --global user.name "xuhaiyan"
$ git config --global user.email "[email protected]" <div id="sina_keyword_ad_area2" class="articalContent "><strong>1.创建本地分支</strong><div>git branch 分支名,例如:git branch 2.0.1.20120806</div><div>注:<span style="line-height: 21px;">2.0.1.20120806是分支名称,可以随便定义。</span></div><div> </div><div><strong>2.切换本地分支</strong></div><div>git checkout 分支名,例如从master切换到分支:git checkout2.0.1.20120806</div><div> </div><div><strong>3.远程分支就是本地分支push到服务器上。比如master就是一个最典型的远程分支(默认)。</strong></div><div>git push origin <wbr><span style="line-height: 21px;">2.0.1.20120806</span></wbr></div><div><span style="line-height: 21px;"> </span></div><div><div><span style="line-height: 21px;"><strong>4.远程分支和本地分支需要区分好,所以,在从服务器上拉取特定分支的时候,需要指定远程分支的名字。</strong></span></div><div><span style="line-height: 21px;">git checkout --trackorigin/</span><span style="line-height: 21px;">2.0.1.20120806</span></div><div>注意该命令由于带有--track参数,所以要求git1.6.4以上!<span style="line-height: 21px;">这样git会自动切换到分支。</span></div><div><span style="line-height: 21px;"> </span></div><div><div><span style="line-height: 21px;"><strong>5.提交分支数据到远程服务器</strong></span></div><div><span style="line-height: 21px;">git push origin<local_branch_name>:<remote_branch_name></span></div><div>例如:</div><div><span style="line-height: 21px;">git pushorigin <wbr></wbr></span><span style="line-height: 21px;">2.0.1.20120806</span><span style="line-height: 21px;">:</span><span style="line-height: 21px;">2.0.1.20120806</span></div><div>一般当前如果不在该分支时,使用这种方式提交。如果当前在 <wbr><span style="line-height: 21px;">2.0.1.20120806</span> <wbr>分支下,也可以直接提交</wbr></wbr></div><div><span style="line-height: 21px;">git push</span></div><div><span style="line-height: 21px;"> </span></div><div><strong>6.删除远程分支</strong></div><div><span style="line-height: 21px;">git push origin:develop</span></div></div></div></div>
$ ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa和id_rsa.pub