User Tools

Site Tools


util:devel:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

util:devel:git [2010/06/25 21:48]
127.0.0.1 external edit
util:devel:git [2022/01/27 15:42] (current)
phil Added some info about SSH as transport
Line 116: Line 116:
 which has been corrected and should be dropped. which has been corrected and should be dropped.
  
 +===== Cloning via SSH =====
 +
 +Using SSH as transport is trivial, as it's widely used for repositories with
 +write access. The URL to use for ''git clone'' or ''git remote'' looks like
 +this:
 +
 +  ssh://[user@]example.com[:port]/path/to/repo.git/
 +
 +An alternative, "scp-like" syntax is supported as well:
 +
 +  [user@]example.com:path/to/repo.git/
 +
 +==== Specifying the SSH Identity ====
 +
 +Sometimes it's not sufficient to clone via SSH and relying upon the first
 +accepted key in ''ssh-agent''. A practical example is having multiple accounts
 +in Github - like with ''gitolite'', all users connect using a common username
 +and are distinguished based on pubkey. This may be given during clone like so, according to a popular answer on [[https://stackoverflow.com/a/41947805|StackOverflow]]:
 +
 +  git clone -c core.sshCommand="/usr/bin/ssh -i /home/me/.ssh/id_rsa_foo" git@github.com:me/repo.git
 +
 +Or fixed after the fact in the local repo's config:
 +
 +  git config --local core.sshCommand "/usr/bin/ssh -i /home/me/.ssh/id_rsa_foo"
  
util/devel/git.txt · Last modified: 2022/01/27 15:42 by phil