{"thread":{"id":"22133","subject":"ssh username environment variable","startedAt":"2010-01-08T20:24:12Z","lastAt":"2010-01-08T20:37:36Z","messageCount":4,"participants":["Chris Packham","Shawn O. Pearce","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"131122","messageId":"a038bef51001081224l33164526y51e5ca064b82b73a@mail.gmail.com","threadId":"22133","inReplyTo":null,"subject":"ssh username environment variable","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2010-01-08T20:24:12Z","receivedAt":"2010-01-08T20:24:12Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"Hi List,\n\nJust wondering if there is an environment variable I can use to tell\ngit or ssh what user name to use for the ssh transport?\n\nI would normally use\n  git clone ssh://myname@example.com/repo.git\n\nbut I'm cloning to a relatively public network drive  (corporate\noverlords don't want git no mater what I say) so I want to do\nsomething like\n  GIT_SSH_USER=myname  git clone ssh://example.com/repo.git\n\nSo that my user name doesn't show in the resulting remote.origin.url\n\nI know I can probably just remove my user name from the config after\nthe the fact but I have to do this for a few repos so I thought I'd\nask if there was a magic environment variable I could set.\n\nThanks.\n"},{"id":"131123","messageId":"20100108202958.GL32155@spearce.org","threadId":"22133","inReplyTo":"a038bef51001081224l33164526y51e5ca064b82b73a@mail.gmail.com","subject":"Re: ssh username environment variable","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2010-01-08T20:29:58Z","receivedAt":"2010-01-08T20:29:58Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Chris Packham <judge.packham@gmail.com> wrote:\n> Just wondering if there is an environment variable I can use to tell\n> git or ssh what user name to use for the ssh transport?\n\nNo.  But you can hack around it:\n\n  cat >$HOME/bin/git-ssh\n  #!/bin/sh\n  ssh -l $GIT_SSH_USER \"$@\"\n  ^D\n\n  GIT_SSH=$HOME/bin/git-ssh GIT_SSH_USER=myname git clone ...\n\n-- \nShawn.\n"},{"id":"131125","messageId":"7vskag9vz0.fsf@alter.siamese.dyndns.org","threadId":"22133","inReplyTo":"20100108202958.GL32155@spearce.org","subject":"Re: ssh username environment variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-08T20:34:43Z","receivedAt":"2010-01-08T20:34:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Chris Packham <judge.packham@gmail.com> wrote:\n>> Just wondering if there is an environment variable I can use to tell\n>> git or ssh what user name to use for the ssh transport?\n>\n> No.  But you can hack around it:\n>\n>   cat >$HOME/bin/git-ssh\n>   #!/bin/sh\n>   ssh -l $GIT_SSH_USER \"$@\"\n>   ^D\n>\n>   GIT_SSH=$HOME/bin/git-ssh GIT_SSH_USER=myname git clone ...\n\nI thought the standard answer was \"use $HOME/.ssh/config\", to set User\nby keying on the remote hostname to which you are going.\n"},{"id":"131126","messageId":"a038bef51001081237h67fd421cg767403bf9f0d99df@mail.gmail.com","threadId":"22133","inReplyTo":"7vskag9vz0.fsf@alter.siamese.dyndns.org","subject":"Re: ssh username environment variable","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2010-01-08T20:37:36Z","receivedAt":"2010-01-08T20:37:36Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"On Fri, Jan 8, 2010 at 3:34 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n>\n>> Chris Packham <judge.packham@gmail.com> wrote:\n>>> Just wondering if there is an environment variable I can use to tell\n>>> git or ssh what user name to use for the ssh transport?\n>>\n>> No.  But you can hack around it:\n>>\n>>   cat >$HOME/bin/git-ssh\n>>   #!/bin/sh\n>>   ssh -l $GIT_SSH_USER \"$@\"\n>>   ^D\n>>\n>>   GIT_SSH=$HOME/bin/git-ssh GIT_SSH_USER=myname git clone ...\n>\n> I thought the standard answer was \"use $HOME/.ssh/config\", to set User\n> by keying on the remote hostname to which you are going.\n>\n\nYeah thats what I've done after reading a few more man pages.\n"}]}