alejandro00
alejandro00

Reputation: 154

Private git server: git clone asks for git@host's password

I've setted up a git private server on my desktop pc (OS ubuntu 21.04), and I whant to be able to work on those repos with my laptop or my desktop pc

But I have problems trying to git clone those repos on my destop pc

$ git clone git@Desktop:/home/git/repo.git
git@Desktop's password:

Instead of asking my password it ask the pasword for git user

Upvotes: 0

Views: 687

Answers (1)

alejandro00
alejandro00

Reputation: 154

Make sure to add id_rsa.pub to /home/git/.ssh/authorized_keys


I found out that I mistakenly add my id_rsa.pub from my_user to the wrong .ssh/authorized_keys file by running cat comand.

/home/git/.ssh/authorized_keys

git@Desktop:~$ cat .ssh/authorized_keys
ssh-rsa L4p70p+k3Y=

/home/my_user/.ssh/authorized_keys

my_user@Desktop:~$ cat .ssh/authorized_keys
ssh-rsa L4p70p+k3Y=
ssh-rsa MY_u53r+k3Y=

I just have to add the missing key and it worked like a charm

my_user@Desktop:~$ git clone git@Desktop:/home/git/repo.git
Cloning into 'repo'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), 632 bytes | 632.00 KiB/s, done.

Upvotes: 1

Related Questions