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
- Already created
git
user (root
,my_user
,git
)
ssh-server
service on
ssh rsa keys
generated (laptop and desktop)
ssh/authorized_keys
configurated
- Able to access via
ssh
from my laptop
- Able to access via
ssh
from my desktop to my destkop withmy_user
- Able to
git push
from my laptop
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
CodePudding user response:
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.