I've got the following question, I've installed a server with CentOS 7. Now I want to use this server for git.
The problem is I can't make an SSH connection to the sever to do this. I already made keys and I putted the id_rsa key in C:\Users\MYNAME.ssh
I also created an git user on the server and putted the public key in /home/git/.ssh/authorized_keys
When I want to clone the repository to my server I use the following command:
$ git clone ssh://git@IP/domains/optiekruymen.be/public_html/.git
The output is
Cloning into 'public_html'...
Enter passphrase for key '/c/Users/MYNAME/.ssh/id_rsa':
git@IP's password:
I don't understand why I still need to give the git password, beceause I want tot use the ssh connection and not the password of the git user.
I generated the key on Centos using ssh-keygen, than i copied using
cat id_rsa.pub >> /home/git/.ssh/authorized_keys
to copy the file to the git user user next i downloaded the key to my pc and copied id_rsa to /c/Users/MYNAME/.ssh/id_rsa
Extra output
.ssh file settings
drwx------ 2 git git 4096 Feb 13 20:59 .ssh
authorized_keys file settings
-rw-r--r-- 1 git git 408 Feb 13 20:53 authorized_keys
other debug info
debug1: Trying private key: /c/Users/USERNAME/.ssh/id_rsa
debug3: sign_and_send_pubkey: RSA
SHA256:xUB8U9Mn3EkwzhLXjsBlZU1tJMViEfM/Yit5Kjkv/TA
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with mic,password
I solved this by adding the user git to the /etc/ssh/sshd_config file
and checking the following configurations
This message means that your private key is password-protected (encrypted with a password), before a connection to the remote host can be made, this key needs to be decrypted (by you inputing the password).
The easiest way to solve thi is to remove the passphrase from the private key.
From this message:
You can see that you are being for the password for the
git
user.As you mentioned above once you added the user to the
/etc/ssh/sshd_config
its no longer asking you for password./etc/ssh/sshd_config file