Hi all, I started gitlab with one project that I cloned using ssh and after generating private and public keys, it has worked fine. Now I have cloned two other projects using ssh and every single time I push or pull to them I am asked to add my keyphrase. It seems that running: eval “$(ssh-agent)” and ssh-add ~/.ssh/id_rsa will allow me to push without entering my passphrase for at least the next push so I was wondering if openSSH process wasn’t running but that wouldn’t explain why I don’t need to do that with my original project. I’ve tried this using git bash shell and powershell.
Apart from 1 repo, the rest of my projects ask for ssh pass phrase everytime I pull or push (regardless of which PC I use)
Hi @oldboysagat, is your ssh key locally protected by a pass phrase?
Hi @deltamotion thanks for the reply. The key is not locally protected and it seems to work fine without needing the passphrase in the folder I pulled my original project into.
Ok … that was kind of a stalling question while I thought it through more.
Interesting, I never use ssh-agent and don’t know what you would use it for… I generate ssh keys (which end up in ~/.ssh/ and then I copy the public key into GitLab, generally via the web interface for the user I am trying to associate that key with. GitLab needs it done this way because generally repos are cloned with the ‘generic’ user git@yourgitlabhost, and GitLab basically uses the stored ssh keys to figure out and impersonate the correct user, parse its permissions, and so forth.
The eval ($ssh-agent) is running a function from the shell that is then adding the ssh key into that particular instance of ssh-agent that is running, but that does not seem like it would be persistent or the normal way to do it.
If you have checked out the repo with a different user, the solution would be to go back and pull it out with the generic user and let GitLab handled the ssh authentication and impersonation.
Hope that helps!
hmm that’s interesting - I’ll give that a go and see how it goes. What you said about eval($ssh-agent) makes sense. If not I’ll try generating another ssh key and adding it to Gitlab.
Sorry, there are so many variables and environmental differences at play here…
I searched around a little bit and that eval stuff showed up in a tutorial for authenticating with GitHub from Windows.
Are you on Windows? On Windows I typically used Cygwin, or even better, the Git bash environment to communicate with GitLab… but there are other options, including Atlassian’s SourceTree (which uses putty’s plink agent) and on and on… Each one of these SSH clients will have their own location to look for SSH keys, which leads to redundancies and multiple SSH keypairs in use from the same host. Not a problem, but can be tricky when figuring out these things…