你如何在GitHub上分发你自己的仓库? [英] How do you fork your own repository on GitHub?

查看:400
本文介绍了你如何在GitHub上分发你自己的仓库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GitHub上有一个公共仓库。我想复制/复制它,并在基于这个存储库的新项目上工作,但我不想影响它现在的状态。我尝试使用GitHub UI分叉,但它没有做任何事情。 解决方案

我不认为你可以分叉自己的回购。

克隆它,并推到一个新的回购是好的,但你需要:

  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

(请参阅

narf 答案(upvoted)也说明了这个过程。



这将允许您创建一个新的存储库,并使用它的GitHub url将旧存储库的完整历史导入到新存储库中。

再说一遍:你得到的是一个副本,而不是一个真正的分支:你不能从新的回购请求到旧的回购请求。

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.

这篇关于你如何在GitHub上分发你自己的仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆