本地项目在github和coding上同步

来源:互联网 发布:centos安装tengine 编辑:程序博客网 时间:2024/06/08 09:04
  • 用过一段时间的github,一直挺顺畅,突然用上了coding,略不适应,因此把coding和github上的远程仓库统一同步.
  • 之前设置过SSH key,其值放在目录/.ssh/id_rsa.pub中,注意不是id_rsa,把id_rsa.pub文件中的ssh值放入
    这里写图片描述
  • 此时已经在github和coding中已经设置好了SSH,用git remote set-url命令实现二者的同步
$git remote add both git@git.coding.net:user/project.git# 添加一个名为 both 的远端$git remote set-url --add --push both git@git.coding.net:user/project.git# 为其添加 push 到 Coding 的 SSH 地址$git remote set-url --add --push both git@github.com:user/repo.git# 为其添加 push 到 GitHub 的 SSH 地址$git remote -v #查看当前远端仓库origin  git@git.coding.net:user/project.git (fetch)origin  git@git.coding.net:user/project.git (push)github  git@github.com:user/repo.git (fetch)github  git@github.com:user/repo.git (push)

之后在推送的时候科研用git push both实现二者同步更新

1 0
原创粉丝点击