On Wed, Jun 25, 2014 at 2:26 AM, treaki <treakiandr...@gmail.com> wrote:
> Hi, > > 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. > > thanks for your help > In git itself? I doubt it. What are you running on your desktop which is doing the git work? Is it Windows? If so, I know _nothing_ about SSH on Windows. But the below might be addressed by the documentation for the SSH software on Windows. About which I know nada. If it is Linux, or one of the *BSDs, which is using OpenSSH, then I may be able to help. In the current OpenSSH, there is a concept called the "Control Master". What this parameter does is multiplex all the SSH connection for a given user over the same SSH connection. In connection with this is the ControlPersist parameter. When you have a "ControlMaster" and set "ControlPersist" to "yes", then the first time an SSH connection for a given user is made, that connection stays active "forever". Or until the client (desktop) is rebooted, signed off, or a "ssh -O exit" command is given on the client (desktop). I use this internally to speed up SSH connections on my internal LAN. I don't use it over the Internet very much because it isn't worth it to me, due to minimal use. The plus of this is that the same SSH connection is used "forever", saving time and overhead. Good if you are doing a _lot_ of git push / pull type operations to a single server. What I do use over the Internet, again on Linux, is to use the "ssh-add" command on my desktop. What this does is cache the SSH credentials so that I am asked for them only once, when I do the ssh-add. Thereafter, each ssh (or ssh user such as git) uses the cached credentials and doesn't ask me for them. The ssh-add can use a time parameter to indicate how long to cache the credentials. What I do at work is a command like: "ssh-add -t 8h ~/.ssh/server" This caches the credentials for ~/.ssh/server for 8 hours. By which time, I am heading home. To "undo" an ssh-add, you can do "ssh-add -d ~/.ssh/server" to immediately remove the credentials for the "server". Oh, in this case, each ssh session is separate. It is just easier to use because you're not typing in the server's SSH passphrase all the time. Hope this is of some help. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! <>< John McKown -- 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.