Sample Header Ad - 728x90

Ubuntu 22.04 ssh-agent identities not added correctly?

1 vote
0 answers
1852 views
I have my ssh identities added at the end of the .bashrc script, as the server says here when I log in, Agent is running with pid 8411 and all of the identitias are added. As is also evident from the console below, I can not use my identities. In order to use them, I need to type a command to start the ssh agent (which now receives a new pid 8531) and also type the command to add the identity to the agent (again?), and only then will git recognize the identity and allow to pull the repo. What is going on here, what am I doing wrong? Last login: Sat Jul 1 11:51:58 2023 from 162.243.190.66 Agent pid 8411 Identity added: /root/.ssh/id_ed25519 (mattias@domain.se) Identity added: /root/.ssh/id_ed25519_api_requests (mattias@domain.se) Identity added: /root/.ssh/id_ed25519_airspace_sweden (mattias@domain.se) Identity added: /root/.ssh/id_ed25519_hwx (mattias@domain.se) root@DR2-sweden-internal-api:~# cd /var/www/html root@DR2-sweden-internal-api:/var/www/html# ls aircraft airspace airspace-sweden drones index.html root@DR2-sweden-internal-api:/var/www/html# git clone git@github.com:domain/myrepo-api-out-HemsWX.git Cloning into 'myrepo-api-out-HemsWX'... ERROR: Repository not found. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. root@DR2-sweden-internal-api:/var/www/html# eval "$(ssh-agent -s)" Agent pid 8531 root@DR2-sweden-internal-api:/var/www/html# ssh-add ~/.ssh/id_ed25519_hwx Identity added: /root/.ssh/id_ed25519_hwx (mattias@domain.se) root@DR2-sweden-internal-api:/var/www/html# git clone git@github.com:domain/myrepo-api-out-HemsWX.git Cloning into 'myrepo-api-out-HemsWX'... remote: Enumerating objects: 91, done. remote: Counting objects: 100% (91/91), done. remote: Compressing objects: 100% (65/65), done. remote: Total 91 (delta 35), reused 79 (delta 23), pack-reused 0 Receiving objects: 100% (91/91), 20.14 KiB | 2.88 MiB/s, done. Resolving deltas: 100% (35/35), done. This is at the end of my ~/.bashrc #add github deploy keys to agent eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519 ssh-add ~/.ssh/id_ed25519_api_requests ssh-add ~/.ssh/id_ed25519_airspace_sweden ssh-add ~/.ssh/id_ed25519_hwx ------- UPDATE (for Ulrichs comment) ---------- So I notice that the first of the four identities is usable. The -v gave a whole lot of debug lines =) debug1: Connecting to github.com [140.82.121.3] port 22. debug1: Connection established. debug1: identity file /root/.ssh/id_rsa type -1 debug1: identity file /root/.ssh/id_rsa-cert type -1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: identity file /root/.ssh/id_dsa-cert type -1 debug1: identity file /root/.ssh/id_ecdsa type -1 debug1: identity file /root/.ssh/id_ecdsa-cert type -1 debug1: identity file /root/.ssh/id_ecdsa_sk type -1 debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /root/.ssh/id_ed25519 type 3 // origin/master * [new branch] version_1.2 -> origin/version_1.2 root@DR2-sweden-internal-api:/var/www/html/hwx#
Asked by Matt Welander (121 rep)
Jul 1, 2023, 08:57 PM
Last activity: Mar 20, 2025, 12:16 AM