I have multiple repositories that I am contributing to - Some are hosted on Github, and some on Assembla. Technically, my username varies between the two systems.
When I cd
to a given repository's contents, I need to know the following:
git config user.name
, not git config --global user.name
)I am finding that git config --get user.name
yields the correct info, but when I try to pull or commit, I get prompted for my username:
Username for 'https://github.com'
How can I ensure that my identity is linked correctly to both git worlds? I realize that #1 has nothing to do with SSH keys, but committing, although it's part of my setup, so I include it here for reference on what I'm trying to accomplish.
First of all, the config values for user.name, user.email have nothing to do with authentication to server (to allow you push, fetch, etc...), these are only for filling commits messages with author info
One think you could do, is to create a ssh key pair and use the same public key for assembla, and for github. Then, when cloning repositories from github make sure to use the SSH protocol
git@github.com:username/repositoryname.git
instead of
https://github.com/username/repositoryname
(The same for assembla)
if you config it properly, you shouln't be asked for username nor password
NOTE: git@github.com:username/repositoryname.git is a shorthand of ssh://git@github.com:username/repositoryname.git meaning the same
NOTE 2: the book on git-scm explains SSH protocol (among others) here: http://git-scm.com/book/en/Git-on-the-Server-The-Protocols, github always use "git" username and identifies github users using the ssh key