Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git asking for password from command line

Tags:

git

gitosis

I setup git and gitosis on a server to manage my repos. It's working properly for the initial shell account I set it up with, i.e. I can run:

git clone git@MYSERVER:gitosis-admin.git

But when I try to use the separate accounts I've created (via gitosis.conf) it keeps asking for a password:

git clone johndoe@MYSERVER:gitosis-admin.git

I setup the SSH key and pushed a copy to the keydir on the server. This question seems to address the same problem, but the solution given is for tortoisegit.

Git keeps asking for password

How do I tell git to use the ssh key instead of asking for a password?

like image 278
erich Avatar asked Mar 05 '26 04:03

erich


1 Answers

You don't use your user name, you always say:

git clone git@MYSERVER:<repository>

Gitosis associates your name in its config file with the name of your key on the server. That is, you have lines like

[group users]
members = johndoe janeroe
writable = repo1 repo2

in gitosis.conf, and files johndoe.pub, janedoe.pub in gitosis-admin/keydir; gitosis will use the appropriate key for the user but you always use "git" as the user in the URL. That's because it's always using the "git" account.

like image 110
ebneter Avatar answered Mar 07 '26 17:03

ebneter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!