László
László

Reputation: 4144

how to use github with two local repos (of the same project)

I have a setup where users (of a server) cannot reach github.com directly, but we can use git (and the GitHub app) with a local repo on a shared drive. That location can be mounted on other computers on our LAN, incl. my personal computer VPNing in. My question is how I could push it up to github.com to allow versioning with local copies checked out from there — the shared location on the server cannot be a git server for all.

The same personal would also have another version of the same repo — checked out from github.com for offline use, or at least off the LAN. Then how can I also be the one committing server repo?

Upvotes: 1

Views: 377

Answers (1)

GreenAsJade
GreenAsJade

Reputation: 14685

We can consider this from the perspective of your personal computer - I think that this can connect to github when needed, and can connect to the shared drive where the other users have access, right?

This repo can have two remotes defined: github and the shared server copy of the repo:

git remote add github https://github.com/user/repo.git

git remote add shared shared-machine://path/to/repo.git

('github' and 'shared' are arbitrary labels I chose for these two remotes)

You can then push and pull to github, and you can push and pull to the shared machine repo, from your personal machine copy of the repo.

To get the changes from your users:

git pull shared

To push them to github:

git push github

Upvotes: 1

Related Questions