3

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?

2
  • 1
    What does the user section of the .git/config file look like? Commented Feb 16, 2011 at 12:33
  • Have you figured this one out? I'm not sure I understand why you do a git config on a "git init", and not on a "git clone". Can you also provide the "git clone" commands. If they are local, there should be no reasons to ask for ssh passphrase. Commented Dec 27, 2012 at 5:58

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.