First Pass, unedited. If anyone besides myself ends up reading this please leave a comment and I will apply some polish.
Even with the SSH configuratoin stuff below setup correctly you still need to put your identity into each project-level
.git/config
file and not rely on ~/.gitconfig
. While obvious in hind-sight... The UI doesn't have an independment notion
of identity and because you are working on a local clone does not use identity information associated with origin. This
too makes sense as you are able to have multiple remotes associated with a given local repository. If you forget and notice a
commit with bad author information you can use git commit --amend --reset-author
- though it may be that a normal ammend with
do this too...after you have added the [user] name & email
variables to config.
C:/Users/<name>/.ssh/config
- don't bother adding a config here...the one in /etc/ssh/ssh_config
asserts host configuration precedence.
The default configuration also does not generate a known_hosts file, instead redirecting is to /dev/null
Within Windows the PortableGit*
directory serves as the effective root of the Cygwin directory structure for GitHub for Windows.
Therein you will find /etc/ssh/ssh_config
. The configurations in this file will supercede any matching configurations present in
/c/Users/<name>/.ssh/config
. For this reason it will be necessary to remove the Host github.com
entry; sepcifically the "IdentityFile" variable, so that changes made in ~/.ssh/config
can take effect.
Note, on my Windows 7 installation (not positive on the exact configuration choices selected though) the location of the Cygwin PortableGit*
directory is C:/Users/<name>/AppData/Local/GitHub/
Some kind of caching is going on since even removing the default ssh key from ~/.ssh
still allows a ssh <host>
to connect; using the wrong (and not longer existant) set of credentials)...
Said caching likely and reasonably comes from ssh-agent...not sure how the interaction there works but lets reset them and try again...
So indeed it does...needed to kill both ssh-agent process found when running ps ssh-agent
. I figured one was linked to the shell
and the other linked to the GUI. I tried killing only the only logically linked to the GUI to no effect.
Or just ignore the last 3 paragraphs and read this [StackOverflow] (http://stackoverflow.com/questions/7927750/specify-an-ssh-key-for-git-push-for-a-given-domain) post...
Namely, specifying IdentitiesOnly yes
in ~/.ssh/config
so that the default Host entry IdentityFile is not prepended.
Actually, the interaction appears to be that the ssh-agent
database was tried first, in its entireity, and then, if not found
the ~/.ssh directory
was tried. Killing ssh-agent
and using the original setup allowed the correct key to be found. Thus while
the identity files are indeed concatenated they are appended instead of prepended...
Actually, a combination of the two. Since the second entry setups another valid identity if the first IdentityFile is not present, or hasn't been loaded into ssh-agent, the second (default) IdentityFile will be provided.
So, for now I've setup separate host "aliases" in ~/.ssh/config
and updated /etc/ssh/ssh_config
to not assign a default IdentityFile
for github.com
. I'm partial to the supplied "Git Shell (Bash)" interface for cloning and then using the "Add" feature in the GUI to create an entry for the repository.