How do people handle multiple git identities with github+ssh? Since you always log in as the `git` user, you can't reuse keys. I end up with an ~/.ssh/config like: Host github-client1 Hostname github.com User git IdentityFile ~/.ssh/id_rsa-client1 Host github-client2 Hostname github.com User git IdentityFile ~/.ssh/id_rsa-client2 Then clone using `git clone git@github-client1:username/repo.git` Is there a better way?
Here's pretty much what I do: ssh config: Host github.com gist.github.com Hostname %h User git RequestTTY no RemoteCommand none IdentitiesOnly yes ControlMaster no Match host github.com,gist.github.com exec "~/Developer/C/getargv/bin/getargv -0 -s 1 $PPID | env POSIXLY_CORRECT=1 xargs -0 getopt '46AaCfGgKkMNnqsTtVvXxYyB:b:c:D:E:e:F:I:i:J:L:l:m:O:o:p:Q:R:S:W:w:' | perl -pe 's|.*? -- ||' | fgrep -e username1" IdentityF…
Organizing multiple Git identities
91–92 of 92 posts
Re: Organizing multiple Git identities
#92Earlier quoted context omitted.
You can also filter based on the remote URL! I find this much more useful than the location of the directory on disk. ; include only if a remote with the given URL exists (note ; that such a URL may be provided later in a file or in a ; file read after this file is read, as seen in this example) [includeIf "hasconfig:remote.*.url:https://example.com/\*"] path = foo.inc [remote "origin"] url = https://example.com/git*
Handy, didn't know about that, thanks for sharing! The reason for doing it by location is probably because my directory structure for projects look something like this: /home/user/projects/organization/project so github.com/victorb/neat-project would go into /home/user/projects/victor/neat-project So my solution is tailored to that structure I suppose :)
At home (I mean a personal box I for personal project and some other public contributions), my directory structure is like:
~/sources/forge/organisation/project
where `sources` has the same meaning as your `/home/user/projects` ; and your example will end up here to ~/sources/github.com/victorb/neat-project
The structure used has some great influence on solution adopted I think :)