本篇博文作为git日常常用命令总结,不定时更新
拉取自己的代码库,可push
$ git clone git@github.com:myname/myrepository.git
拉取代码库,不可直接push
$ git clone git://github.com/myname/myrepository.git
常用三剑客命令,add commit push
$ git add .
$ git commit -m "add files" .
$ git push origin master
查看本机github配置
$ git config --list
设置本机github用户名与邮箱
$ git config --global user.name "Your Name"
$ git config --global user.email yourmail@example.com
测试git连接是否正常
$ ssh -T git@github.com
生成公钥和密钥
$ ssh-keygen -t rsa -C "yourmail@example.com"
冲突后强制覆盖掉本地
$ git reset --hard
$ git pull
本文最先发布于molock.cn,帆的博客。
网友评论