微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么我在使用 git mirror 命令时会出错?

如何解决为什么我在使用 git mirror 命令时会出错?

我在镜像我的存储库时遇到问题。以下命令有效:

git clone --bare https://github.com/my_username/my-repo.git
cd my-repo

还有一个我想要镜像的空存储库。该存储库归另一个人所有,但我可以访问它,因为我可以在我的 GitHub 帐户中看到它。

当我执行以下命令时,出现错误

git push --mirror https://github.com/their-username/their-repo

remote: Repository not found.
fatal: repository ‘https://github.com/their-username/their-repo/’ not found

存储库:

  1. https://github.com/my-username/my-repo(这是我的存储库,其中包含我的用户名
  2. https://github.com/their-username/their-repo(这是他们的存储库,有他们的用户名

我正在尝试将 1 镜像到 2。我可以成功克隆两个存储库

解决方法

Git 内置了镜像功能

来自你的仓库

git push --mirror https://github.com/their-username/their-repo

请注意,这将完全覆盖他们的存储库,因此您应该确保他们对此没有问题。

,

答案是:

我有只读访问权限,而不是读写访问权限。我给我的组织发送了电子邮件,他们改变了这一点,并且奏效了。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。