你如何在 GitHub 上 fork 自己的仓库? [英] How do you fork your own repository on GitHub?
问题描述
我在 GitHub 上有一个公共存储库.我想复制/复制它并在基于此存储库的新项目上工作,但我不想影响它现在的样子.我尝试使用 GitHub UI 对它进行分叉,但它没有做任何事情.
我不认为你可以 fork 自己的 repo.
克隆它并将其推送到新的存储库很好,但您需要:
git clone https://github.com/userName/Repo New_Repocd New_Repogit remote set-url origin https://github.com/userName/New_Repogit remote 添加上游 https://github.com/userName/Repogit push origin mastergit push --all
(见
这将允许您创建一个新存储库,并使用其 GitHub url 将旧存储库的完整历史记录导入到新存储库中.
再说一次:你得到的是一份副本,而不是真正的分叉:你不能从新仓库向旧仓库发出拉取请求.
再次 (bis),如上所述 在mpersico
的评论中,这不是 一个真正的叉子.
如果我有一个 foo 是一个开源项目的规范源代码仓库,我希望其他人可以将其分叉并有权进行 PR,那么我不想在该仓库中工作,我想要一个我可以的分叉用于针对我的项目发布适当的 PR.
我已经解决了这个问题,我在 GitHub 中创建了第二个帐户并分叉到那个帐户.
I have a public repository on GitHub. I want to replicate/copy it and work on a new project based on this repository, but I don't want to affect how it is now. I tried forking it using the GitHub UI but it didn't do anything.
I don't think you can fork your own repo.
Clone it and push it to a new repo is good but you need to:
git clone https://github.com/userName/Repo New_Repo
cd New_Repo
git remote set-url origin https://github.com/userName/New_Repo
git remote add upstream https://github.com/userName/Repo
git push origin master
git push --all
(see git push
)
See the all process described at "Fork your own project on GitHub".
Six years later (2016), you now have the GitHub importer which allows you to import a repo from another source... including GitHub.
See "Importing a repository with GitHub Importer"
narf's answer (upvoted) also illustrate that process.
That will allow you to create a new repository and import the full history of the old one into the new one, using its GitHub url.
Again: what you get is a copy, not a real fork: you cannot make pull request from the new repo to the old one.
Again (bis), as stated in the comments by mpersico
, this is not a TRUE FORK.
If I have a foo which is the canonical source repo for an open source project that I want other people to fork and have access to do PR, then I do not want to work in that repo, I want a fork I can use to issue proper PRs against my project.
I have solved this my creating a second account in GitHub and forking to that.
这篇关于你如何在 GitHub 上 fork 自己的仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!