Reputation: 284
I would like to setup a github repository that is connected to overleaf. The overleaf instance runs on a university machine and does not have github integration. The main goal is to integrate changes from people working on github and on overleaf and to commit to these two places simultaneously.
So I think the solution is to work with two remotes: one github one overleaf. I found out how to push to two remotes, but there are still open issues. overleaf only has the branch master
and github has the branch main
.
I would like to have a setting where I pull and push to two remotes with one command from the GUI. I guess the GUI takes origin
. This is what does the push part:
git remote set-url --add --push origin https://github.com/…
git remote set-url --add --push origin https://[email protected]/git/…
I still have problems with branches though (main vs. master).
And I do not know how to get pull to pull from two sources simultaneously.
Upvotes: 0
Views: 52
Reputation: 11
I think you have a slight misunderstanding of how git repositories work. Each location of the repository is independent of each other. Hosting sites like github or overleaf are just agreed upon, by your group, location for the Master/Main copy. In your case you have 2 locations for the master/main which is fine as long as all members of your group ALWAYS push to both locations like you have set up on your computer. I have doubts that any group will ALWAYs follow the rules. A better method would be to prevent users from pushing directly to master/main and follow a review process to merge their changes to main/master on one of the hosting sites then push/pull it to the other from there.
I still have problems with branches though (main vs. master).
Those are only the agreed upon names for the most up to date version (default). you can set it to what ever you want "main", "master", "original", ... . in other words you can change the "default" on one or the other or both. here is how you do it on github: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch change git hub to "master" and now both have the same default branch.
And I do not know how to get pull to pull from two sources simultaneously.
you would never need to do this, as long as both are in sync. I doubt you check your bank account balance on your PC and then go to an ATM to check it again.
Ive never done set up and automatic push, but github has instructions on how to do this: https://gist.github.com/nichtich/5290675
Upvotes: 1