Configuring ssh-agent to autostart and automatically add ssh keys to it in Manjaro i3

, , ,

I have just seen this post on the forum and I tried to replicate the same on my Manjaro Linux with i3 window manager. Sadly, I didn’t have success, when I open pycharm or clion I get the message git@github.com Permission denied: could not read from remote repository. Same if I do a push to a repository from my terminal (kitty). I’m using bash as shell. Do anyone know if I need to setup anything else?

This is the status of my systemctl daemon:

[user@user-asuszephyrus ~]$ systemctl --user status ssh-agent.service
● ssh-agent.service - SSH agent (ssh-agent)
     Loaded: loaded (/home/user/.config/systemd/user/ssh-agent.service; enabled; preset: enabled)
     Active: active (running) since Fri 2022-07-29 00:13:04 BST; 3s ago
    Process: 3814 ExecStartPost=/bin/sleep 3 (code=exited, status=0/SUCCESS)
    Process: 3818 ExecStartPost=/bin/bash -c /usr/bin/ssh-add /home/user/.ssh/github_ed25519 (code=exi>
   Main PID: 3813 (ssh-agent)
      Tasks: 1 (limit: 18474)
     Memory: 552.0K
        CPU: 12ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/ssh-agent.service
             └─3813 ssh-agent -D -a /run/user/1000/ssh-agent.socket

Jul 29 00:13:01 user-asuszephyrus systemd[847]: Starting SSH agent (ssh-agent)...
Jul 29 00:13:01 user-asuszephyrus ssh-agent[3813]: SSH_AUTH_SOCK=/run/user/1000/ssh-agent.socket; expo>
Jul 29 00:13:01 user-asuszephyrus ssh-agent[3813]: echo Agent pid 3813;
Jul 29 00:13:04 user-asuszephyrus bash[3818]: Identity added: /home/user/.ssh/github_ed25519 (user>
Jul 29 00:13:04 user-asuszephyrus systemd[847]: Started SSH agent (ssh-agent).

Cheers,

1 Like

The service is enabled and running, nothing to do here.

That mean you don’t have permissions to repository on Github. Did you added your SSH key to your Github account? See here Adding a new SSH key to your GitHub account - GitHub Docs

Yep, the SSH key has already been added to my Github account. In fact if I do this in the terminal:

eval "$(ssh-agent -s)"
and
ssh-add ~/.ssh/github_ed25519

Then I’m able to push. Obviously, I don´t want to do this every time I need to push and I also want pycharm, clion and vscode to work with git. So I guess the problem is that the applications are somehow not able to “see” the identities?

Did you tried create config for Github? Something like that should be enough:

Hostname github.com
    Host github.com
    IdentityFile=~/.ssh/github_ed25519

Add this to ~/.ssh/config

1 Like

Awesome!

That worked. Thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.