Home > Software engineering >  Is the ssh key used once?
Is the ssh key used once?

Time:09-02

I have created an ssh key with a passphrase and connected it with github successfully and use the ssh -T [email protected] to test it and it asked me for the passphrase and it worked. But now when I push or pull anything it doesn't ask me for the passphrase so I thought that the key isn't used, So I deleted it and worked without it and git nor github didn't even ask me for anything, and the work is done. So my question here is I need to know how to link this ssh key to github and make it ask me about the passphrase of the key whenever I do any thing. Thanks in advance.

CodePudding user response:

navigate here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
section: Adding your SSH key to the ssh-agent

CodePudding user response:

But now when I push or pull anything it doesn't ask me for the passphrase so I thought that the key isn't used, So I deleted it and worked without it and git nor github didn't even ask me for anything, and the work is done.

Check first what kind of URL your local repository is actually using.

cd /path/to/local/repository
git remote -v

If it is an HTTPS one, then Git would not ask anything if your credentials (user account name/token) were already cached in the credential helper (git config --global credential.helper)

That would explain why even deleting the SSH key has no effect in your case.

  • Related