小言_互联网的博客

Github和Coding同步

347人阅读  评论(0)

之前设置过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实现二者同步更新

以上会出现一些问题,报错:

Host key verification failed.

我使用TortoiseGit进行push弹出对话框

然后将id_rsa中的数据粘贴到输入框中

在弹出输入框,输入yes

解决以上问题


转载:https://blog.csdn.net/Hubz131/article/details/101911486
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场