On Wed, 25 Jun 2014 00:26:50 -0700 (PDT) treaki <treakiandr...@gmail.com> wrote:
> i am using git with an ssh remote running at my router@home. the most > times i use it the following way: > > git pull > git push > > the problem i see it that he ueses 2 ssh sessions for this job, so i > would like to ask if there is a way to do everything together using > one session. The imaginary `git pull-push` has no sense as `git pull` might legitimately result in a merge conflict. Note that `git pull` is a sort of macro for `git fetch` + `git merge` which just makes certain (rather strong) assumptions about your workflow. Think about this a bit more and you'll see that in fact you want `git fetch-merge-push` which looks rather awkward and only suitable for some automated changeset processing (and, honestly, I can't even fancy one). On the other hand, the problem might be scripted around using a relatively recent implementation of OpenSSH (>= 4.0) which gained support for client-side multiplexing. The whole process is explained in [1] (and various blog posts -- google for OpenSSH+ControlMaster), but the basic idea is like this: either create an entry in ~/.ssh/config for your host "home" setting up multiplexing for it, and it should work automatically, or write a git-pull-push script which would properly cook the GIT_SSH environment variable passed to each Git invocation making sure the first one instantiates the master connection and the second just uses it; at exit the master instance should be told to quit. 1. http://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.