I have a git bare repository as a remote on a server with 2 network interfaces, whose IP address are 192.168.x.x and 223.x.x.x respectively. I have a signle git project on this single remote origin. Inside the lab this remote can only be accessed via 192.168.x.x (CISCO hairpin disabled), and vice versa (which of course).
Can this remote origin be accessed via like one "git push" or one "git pull" regardless of what network my laptop is on?
On my laptop I tried,
git remote add origin ssh://[email protected]/home/gogma/git/prj.git
git remote set-url --add origin ssh://[email protected]/home/gogma/git/prj.git
didn't seem to work. no issues with ssh itself.
This is what I have:
$ git remote -v
origin ssh://[email protected]/home/gogma/git/prj.git (fetch)
origin ssh://[email protected]/home/gogma/git/prj.git (push)
origin ssh://[email protected]/home/gogma/git/prj.git (push)
$
That would fail on one, and succeed on the other origin psuhURL entry entry on every git push/pull/clone.
I would rather clone it twice:
igin is set tossh://[email protected]/home/gogma/git/prj.gitoriginis set tossh://[email protected]/home/gogma/git/prj.gitDepending on the network, my
.bashrcwould symlink the right folder to a common path.Each one has a
otherNetworkremote entry in order for you to do agit fetch otherNetworkwhen switching/path/to/project, getting the latest commits you did from one folder into the other.