繁体   English   中英

将更改从github公共存储库拉到github私有存储库

[英]Pull changes from a github public repository to github private repository

我裸露克隆了一个公共github存储库(例如projectA),并创建了一个私有github存储库(例如projectAPrivate),然后镜像将克隆的projectA推送到projectAPrivate(此处概述为https://help.github.com/articles/duplicating-a -存储库

git clone --bare https://github.com/exampleuser/old-repository.git
# Make a bare clone of the repository

cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
# Mirror-push to the new repository

cd ..
rm -rf old-repository.git
# Remove our temporary local repository

从那时起,我将更改推送到projectAPrivate,现在projectA发布了新版本。 我如何从公共projectA存储库到我的私有github项目projectAprivate进行拉/合并更改。

我认为Github的帮助页面也提供了您问题的答案: https : //help.github.com/articles/duplicating-a-repository

如果要在其他位置镜像存储库,包括从原始位置获取更新,则可以克隆镜像并定期推送更改。

$ git clone --mirror
$ https://github.com/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repositor

$ cd repository-to-mirror.git git remote set-url --push origin
$ https://github.com/exampleuser/mirrored
# Set the push location to your mirror 

与裸克隆一样,镜像克隆包括所有远程分支和标记,但是每次提取时所有本地引用都将被覆盖,因此它始终与原始存储库相同。 设置推送的URL可以简化推送到镜像的过程。 要更新镜像,请获取更新并推送,这可以通过运行cron作业自动进行。

git fetch -p origin 
git push --mirror

您可以在projectAPrivate根目录上运行follow命令

git remote add public https://github.com/exampleuser/old-repository.git
git pull public master

然后,您将从projectA存储库中获取所有更新,然后请合并更改,解决冲突等,然后,您可以运行follow命令将其提交给projectAPrivate

git push origin master

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM