Linux 下用命令鏈接Github
阿新 • • 發佈:2018-03-24
merge git clas QQ -a linu .com 驗證 linux
用命令鏈接github
初始化
需要用ssh公鑰鏈接到github,註意不能從vim中直接復制
介紹一個命令: xsel < test.txt
將文件中內容直接復制到剪切板中
具體做法
git remote add pprp www.github.com/name
ssh-keygen -t rsa -C "[email protected]"
xsel < /home/name/.ssh/id_rsa.pub
具體應用
添加到遠程庫
git remote add origin//添加遠程倉庫 [email protected]:pprp/deeplearning.git git push -u origin master
生成ssh-key:
ssh-keygen -t rsa -C "[email protected]"
驗證是否成功:
ssh -T [email protected]
本地更新遠端修改
git fetch origin
將更新同步到本地:
git merge origin/master
新建文件以後上傳
git add newfilename
git commit -m "message"
git push origin master
增加刪除分支
git remote -v 查看 git remote add name [email protected]:pprp/deeplearning.git git remote rm name
克隆庫文件
git clone
git clone http://github.com/pprp/nameofrepo
可以不用add
git commit -am 'message'
查看提交歷史
git log
git log --oneline 簡潔版
分支操作
git branch newnameforbranch
git checkout newnameforbranch
git branch -d newnameforbranch 刪除
Linux 下用命令鏈接Github