Reputation: 10857
Everything works for the first user (Git user, not Unix user), let's call him aaa, against the first repository. aaa is set as git user.name and user.email globally using the command
git config --global user.name "aaa"
git config --global user.email [email protected]
aaa executes the command
git push origin master
successfully.
Then I have a second user, let's call him bbb (again Git user, not Unix usr) on the same machine, but different local working directory, trying to push to a different Git repository. First, I override the user.name and user.email properties. So right after git init, I execute:
git config user.name "bbb"
git config user.email [email protected]
Then to confirm:
git config --get user.name
does return bbb. When I try to have bbb push to his own repository, git prompts for the SSH passphrase, and it seems to accept the passphrase, but errors out by saying permission denied to aaa.
I suspect that this has something to do with SSH keys. Is that a right assumption?
Upvotes: 3
Views: 1147
Reputation: 27403
The configured username used for the commit entry in the history, but not for the ssh connection. If you want that to use another username than the one you're logged in with you have to modify the respective .git/config
's origin url. I guess url = ssh://bbb@server/...
might do. If you want a password-free login, you'll have to setup a sshkey for aaa to login as bbb on the server, or use something like gitolite or gitosis.
Upvotes: 4
Reputation: 1323553
On a ssh protocol, you shouldn't have to enter the ssh passphrase:
a "ssh username@servername
" should give you access to the remote (secure) shell.
A permission denied means there is some encapsulation (ssh-based) around your server, like a gitolite.
The only way gitolite will take bbb
for aaa
is if bbb
used the public key (and access to the private key) of aaa
, which could be the case if its $HOME
is somehow the same than aaa
.
Upvotes: 0