要复制存储库而不是派生存储库,可以运行特殊的克隆命令,然后将其镜像推送到新存储库。
$ git clone --bare https://github.com/exampleuser/old-repository.git
$ cd old-repository.git
$ git push --mirror https://github.com/exampleuser/new-repository.git
$ cd ..
$ rm -rf old-repository.git
好的,就这样!现在您可以删除原始存储库(虽然我建议只添加 old-
并更新README和描述),并确保记住重新克隆正确的存储库!
如果您想保留原始名称,请在完成后重命名它。
git push --mirror git@github..../my-new-repository.git
时,出现错误: "! [remote rejected example_branch -> example_branch (pre-receive hook declined) error: failed to push some refs to .../my-new-repository.git"。请问有什么解决办法吗? - Wassadamo您将使用浏览器从分支创建一个PR,当从分支创建PR时,上游存储库将始终是默认基础。要更改此行为,您需要使用浏览器插件来更改比较页面的URL。
https://github.com/<OWNER>/<BASE REPO>/compare/<BRANCH>...<FORK REPO>:<BRANCH>
https://github.com/<YOUR>/<FORK REPO>/compare/<BRANCH>...<FORK REPO>:<BRANCH>