Using an Ubuntu server, I have the following user:
uid=1001(githubactions) gid=1001(githubactions) groups=1001(githubactions),27(sudo),33(www-data),998(docker)
logged in as this user, I create a ssh key pair with `ssh-keygen -t rsa -b 4096 -C "githubactions key" -f ~/.ssh/githubactions
When I run git clone git@github.com:user/repo.git I get: git@github.com: Permission denied (publickey)
Github has a very good article about that issue. When I run ssh-add -l -E sha256 I get Could not open a connection to your authentication agent..
Next, I add my private key to my ssh agent:
> eval "$(ssh-agent -s)"
Agent pid 1022567
> ssh-add ~/.ssh/githubactions
Enter passphrase for /home/githubactions/.ssh/githubactions:
Identity added: /home/githubactions/.ssh/githubactions (githubactions key)
I am now able to clone the repo. And now here is my issue:
When I log out and back in, I am again not able to clone the repo using ssh with the error git@github.com: Permission denied (publickey) again.
Do I maybe have this issue, because I renamed my files and don't use id_rsa?
The user must be able re-use the key after logout, as I want to use it to pull the repo remotely using GitHub actions.