简体   繁体   English

Github:将更改从一个仓库推送到另一个仓库

[英]Github: Push changes from one repo to another

We are working on project where the client uses github as their repository. 我们正在研究客户端使用github作为其存储库的项目。 The client created an id for me and asked me to fork the project and push all the changes in my fork and create a pull request for the changes to be pushed to the main branch. 客户端为我创建了一个ID,并要求我分叉项目并将所有更改推送到我的叉中,并创建一个拉取请求,以将更改推送到主分支。 This works fine. 这很好。

But I manage a team of developers and no one has access to the github repo but me. 但是我管理着一组开发人员,只有我可以访问github存储库。 So I have to collate all the changes and push it in to the github fork all the time. 因此,我必须整理所有更改并将其始终推送到github分支中。

But within our company we do have a gitlab license and we can create our repositories to which all our developers will have to access to it. 但是在我们公司内部,我们确实拥有gitlab许可证,我们可以创建我们所有开发人员都必须访问它的存储库。

So my question is how do I create a link between the gitlab repo to github repo? 所以我的问题是如何在gitlab存储库和github存储库之间创建链接? How do I push the changes from my gitlab to github repo? 如何将更改从gitlab推送到github repo?

Add a new remote with the url of github-repo into your gitlab-repo then push the changes to github-repo . 在您的gitlab-repo添加一个带有github-repo的URL的新遥控器,然后将更改推送到github-repo

Go into gitlab repo then add a new remote (say, github-repo ) with the URL of github repo. 进入gitlab repo,然后添加一个带有github repo URL的新远程(例如github-repo )。

# go into your gitlab repo
$ git remote add github-repo <github-repo-url>

Push gitlab repo's master branch changes to github repo's master branch. gitlab repo's master分支推gitlab repo's master github repo's master分支。

$ git checkout master                
$ git push github-repo master    # push gitlab-repo master branch changes to github-repo master branch

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

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