Here is the situation. There are two machines, laptop A and workstation B. B has a fixed IP, A has a dynamic IP, and I want to avoid the need of connecting from B to A (setting up an ssh tunnel for example; for the sake of the argument, assume that ssh from B to A is not possible).
There is a git repository,
/home/user/foo.git, on both machines. Problem: working on A, merge the changes on
B:/home/user/foo.git. In the end, both repositories should be identical.
The simplest solution I was able to come up with is as follows:
A:~$ cd foo.git A:~/foo.git$ git commit -a A:~/foo.git$ ssh B B:~$ cd foo.git B:~/foo.git$ git commit -a B:~/foo.git$ logout A:~/foo.git$ git pull ssh://B/home/user/foo.git A:~/foo.git$ git push ssh://B/home/user/foo.git master
(before being able to do that, I had to change git config on B and add a post-receive hook as described in the answer to this stackoverflow question)
1) is the above correct? 2) is there a simpler way of achieving the same purpose?