Git常用命令

  1. 各客户端生成密匙和公匙: ssh-keygen -t rsa
  2. 服务器创建git用户及目录 /home/git/.ssh/
  3. 将id_rsa.pub 拷贝到B的/home/git/.ssh/中,添加到authorized_keys文件: cat id_rsa.pub > authorized_keys
  4. 设置sshd相关权限
  5. 服务器端,创建repository目录: git --bare init
  6. 客户端,创建目录,然后 git init
  7. git clone ssh://git@xxxxxx/path/to/
  8. 客户端,添加或修改文件,然后 git add xxx.file, git commit -m "what modified by who"
  9. 客户端,添加远程repository: git remote add work_mygit ssh://git@xxxxxx/home/git/work/mygit/
  10. 客户端,把更改推送到服务器:git push -u work_mygit master
  11. 其他客户端,获取最新版代码:
    1. git remote add remoteworkpath ssh://git@xxxxxx/home/git/work/mygit/
    2. git fetch remoteworkpath master
    3. git status
    4. git log -p master.. remoteworkpath/master
    5. git merge remoteworkpath/master

 

posted @ 2016-08-23 17:07  Ready!  阅读(191)  评论(0编辑  收藏  举报