0

Everytime my laptop connect to company's wifi, and committing/fetching something, git always pops error permission denied so I have to add the ssh key. The problem is that it doesn't effect permanently, I have to do it again everyday with the following commands:

cd ~/.ssh
ssh-add ssh_key

After this, everything works fine. Is there anyway to do it once and for all?

1
  • ssh-add means you are using ssh-agent. By design, it is not persistent.
    – Daniel B
    Commented Jan 18, 2023 at 5:33

1 Answer 1

0

You likely need to rename your ssh_key file or specify it in your ssh config.

I believe the default identity files are id_rsa, id_dsa, id_ecdsa, id_ed25519.

Rename your file to one of these and ensure it is in ~/.ssh and I think that will solve the issue.

Alternatively add/edit your ~/.ssh/config file with an appropriate line to use this key. Possibly something like

 Host *
      IdentityFile ~/.ssh/ssh_key
1
  • You should also verify the permission are correct, only the user of the key, can have access to the key.
    – Ramhound
    Commented Jan 18, 2023 at 4:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .