第1步:创建SSH Key
#ssh-keygen -t rsa -C 邮箱

Id_rsa秘钥 Id_rsa.pub公钥

第3步:登陆GitHub,打开“Accountsettings”,“SSH Keys”页面



第2步:添加远程仓库,登陆GitHub,然后,在右上角找到“Create a new repo”按钮,创建一个新的仓库:


第4步:把本地仓库和远程仓库进行关联
#git remote add origin git@github.com:leijhArvin/0704hello.git

把本地库的master分支内容推送到远程库上:
#git push -u origin master

把本地库的dev分支内容推送到远程库上:
git push -u origin dev

从远程仓库克隆
第1步:找到地址

执行clone命令
#git clone git@github.com:leijhArvin/0704hello.git
在clone时默认是把当前地址里面的所有分支全部clone下来,但是只有master显示,因为没有关联dev分支:
#git checkout -b dev origin/dev

网友评论