如何将我的本地存储库与位桶上的远程存储库合并?

How to merge my local repository with remote repository on bit-bucket?

我正在开发 github 上可用的开放堆栈项目。现在我的队友在他们的本地系统上下载并在 bit-bucket 上制作远程存储库,我想与远程的 bit-bucket 存储库同步。这样我就可以在我的本地系统上获得更新的存储库,我将如何做到这一点。 我已经完成了

[vagrant@localhost horizon]$ git remote rm origin
[vagrant@localhost horizon]$ git remote add origin ssh://git@bitbucket.org/user_name/repo_name.git
[vagrant@localhost horizon]$ git push -u origin master
Warning: Permanently added the RSA host key for IP address '131.103.20.167' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

只需将新的 bitbucket 存储库添加为远程。

git remote add neworigin <bitbucket-repo-url>

然后您可以获取并合并,

git fetch neworigin
git merge neworigin/<branch>

如果要将其命名为 origin,则必须重命名或删除现有遥控器。

您还需要确保已将 SSH 密钥添加到您的帐户。 Read here on how to add an ssh key 如果您没有 public 密钥。您可以通过(在您的主目录中的 .ssh 目录中)生成它,

ssh-keygen -t rsa -C "hello@world.com"

更新

您正在使用 ssh 协议,请使用 https url。然后它会要求您输入用户名和密码。

您可以使用工具 TortoiseHG 或 SourceTree 将远程仓库与本地同步

参考此 link 在本地克隆它