Re: how to pass ssh options to git?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Linus Torvalds <torvalds@xxxxxxxx> wrote:
> It's really better to use a ".ssh/config" file instead.
> 
> I realize that you want to use different options "dynamically", but what 
> you can do is to just have different "fake hostnames". For example, you 
> can do
> 
> 	Host private.host.com
> 		User myname
> 		Hostname host.com
> 		IdentityFile /home/myname/.ssh/private-identity
> 	Host public.host.com
> 		User groupname
> 		Hostname host.com
> 		IdentityFile /home/myname/.ssh/public-identity

I often setup not only multiple fake hostnames in my .ssh/config
but I also setup multiple remote files under any given repository's
.git/remotes directory, using one file per fake hostname.

That way I can pick which options to apply at the time of git push
or git fetch by just changing the name passed to it.

	$ ls .git/remotes
	private public

	$ cat .git/remotes/private
	URL: private.host.com:/path/to/repo
	Pull: refs/heads/master:refs/heads/origin

	$ cat .git/remotes/public
	URL: public.host.com:/path/to/repo
	Pull: refs/heads/master:refs/heads/origin

	$ git push private
	$ git fetch public

I often need this to traverse around firewalls and whatnot.
It works pretty well, assuming I can remember where I'm currently
connected to.  :-)

-- 
Shawn.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]