假设我在git.fedorahosted.org上有一个存储库,我想将其克隆到我在github的帐户中,以拥有自己的游乐场,而不是在fedorahosted上更“官方”的回购。 最初复制的步骤是什么? 在github中有一个漂亮的“fork”按钮,但我不能使用这个明显的原因。
我如何跟踪fedorahosting回购到github的变化?
假设我在git.fedorahosted.org上有一个存储库,我想将其克隆到我在github的帐户中,以拥有自己的游乐场,而不是在fedorahosted上更“官方”的回购。 最初复制的步骤是什么? 在github中有一个漂亮的“fork”按钮,但我不能使用这个明显的原因。
我如何跟踪fedorahosting回购到github的变化?
当前回答
在github创建一个新的回购。 将repo从fedorahosted复制到本地机器。 Git远程重命名上游源 git远程添加源URL_TO_GITHUB_REPO Git push origin master
现在你可以使用它就像任何其他github回购。要从上游导入补丁,只需运行git pull upstream master && git push origin master。
其他回答
Visual studio 2022和默认的git扩展甚至不需要一行命令就可以完美地工作。
步骤1:进入git设置
步骤2:在git/azure中添加指向不同存储库的新原点
步骤3:现在你可以选择在git/azure的不同存储库中推送到新的原点
现在在新的存储库中有了一个新的分支
如果你有现有Git存储库:
cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab.com/newproject
git push -u origin --all
git push -u origin --tags
要将你现有的回购变为不同的,你需要:
首先克隆原始的回购。 Git克隆https://git.fedorahosted.org/cgit/rhq/rhq.git 将克隆的源代码推到您的新存储库: cd rhq Git推送https://github.com/user/example master:master
您可以将master:master改为source:destination分支。
如果你想要推送特定的提交(分支),那么做:
On the original repo, create and checkout a new branch: git checkout -b new_branch Choose and reset to the point which you want to start with: git log # Find the interesting hash git reset 4b62bdc9087bf33cc01d0462bf16bbf396369c81 --hard Alternatively select the commit by git cherry-pick to append into existing HEAD. Then push to your new repo: git push https://github.com/user/example new_branch:master If you're rebasing, use -f for force push (not recommended). Run git reflog to see history of changes.
这个问题的答案已经被删除了,但有一个有用的链接:https://help.github.com/articles/duplicating-a-repository
重点是
0. create the new empty repository (say, on github)
1. make a bare clone of the repository in some temporary location
2. change to the temporary location
3. perform a mirror-push to the new repository
4. change to another location and delete the temporary location
OP的例子:
在本地机器上
$ cd $HOME
$ git clone --bare https://git.fedorahosted.org/the/path/to/my_repo.git
$ cd my_repo.git
$ git push --mirror https://github.com/my_username/my_repo.git
$ cd ..
$ rm -rf my_repo.git
在github创建一个新的回购。 将repo从fedorahosted复制到本地机器。 Git远程重命名上游源 git远程添加源URL_TO_GITHUB_REPO Git push origin master
现在你可以使用它就像任何其他github回购。要从上游导入补丁,只需运行git pull upstream master && git push origin master。