How to permanently save SSH Key passphrase in Gitkraken? - gitkraken

I'm using Gitkraken and it keeps forgetting my SSH Key passphrase after every restart of the app. I've tried ssh-add with the Gitkraken CLI/Terminal, but I haven't been able to figure out how to make Gitkraken remember the SSH Key passphrase in between restarts. Can somebody educate me how to do this?

I fixed this by using the local SSH agent on Mac (Ventura OS):
SSG Agent parameter location in Gitkraken
And prior to that I had to load automatically my passphrase in my .zshrc (not sure if it's mandatory to make it work with Gitkraken):
ssh-add --apple-use-keychain ~/.ssh/id_rsa

Related

Is the ssh key used once?

I have created an ssh key with a passphrase and connected it with github successfully and use the ssh -T git#github.com 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.
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.

How could I setup a permanent connection to github from server with SSH key?

I followed the guide from https://help.github.com/articles/generating-ssh-keys/ to generate a ssh key used to connect to github from my server.
The problem is if I close the shell and login the server again, I have to repeat below steps to reconnect to github, otherwise the accessing will be denied:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
How can I setup a permanent connection with github?
Since you are logging on to the command-line (presumably using SSH) all applications that you run, including ssh-agent, stop when you log out.
In my opinion your best bet is to have your CentOS machine start ssh-agent for you each time you log in, then manually use ssh-add to add your key. This can be done by modifying your shell's login script. If you are using bash, this file is called ~/.bash_profile. If you are using another shell, refer to its documentation and choose an appropriate file.
Edit one of these files and add eval "$(ssh-agent -s)" at the end.
Now, each time you log in ssh-agent should automatically start, and you can optionally run ssh-add (since you are using a file that ssh-add looks for by default you don't need to pass the file to the command) to add your key, then do Git stuff.
It sounds like you want to automate the adding of the key as well. This isn't something that I would choose to do since I like adding keys to be explicit, but because you don't have a passphrase on your SSH key you should be able to add ssh-add to the same file we modified above (after we start the agent, of course) and have your key added automatically.
Thanks #Chris
I did the following and it worked:-
Step1:- .bash_profile
Step2:- enter image description here
Step3:-source .bash_profile
Step4:- enter image description here

Why do I need to run `ssh-add` in my Powershell profile?

In my Microsoft.PowerShell_profile.ps1 document, I've had to add ssh-add ~/.ssh/github_rsa following the poshgit examples in order for it to connect to my GitHub repos.
# Load posh-git example profile
. 'C:\tools\poshgit\dahlbyk-posh-git-8aecd99\profile.example.ps1'
ssh-add ~/.ssh/github_rsa
If I don't have that in my profile, I Github gives me permissions errors when I try to connect.
If I do it manually, it will work for the entire duration of my desktop session, but as soon as I reboot my computer, I need to re-run the command.
Why doesn't poshgit and ssh-add remember the rsa that I've added? It seems wrong to have to re-add it every time.
It's because your rsa key is not the default name ( id_rsa ) so you either need to use ssh-add (which adds it to a running service that remembers the key decrypted with your passphrase) or just add an entry into your ~\.shh\config
~\.ssh\config (create or edit):
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/github_rsa
Or, if github is the only thing you use ssh keys for, just rename the key to id_rsa and then git (well ssh.exe) will find it for you automatically AND poshgit will ssh-add it for you (to handle passphrases).

Auto Unload Key From SSH

Why did I get the following error (on the same machine where the github connection had been properly set up before)? Meaning, it worked the previous day (e.g. I could push, pull, etc. with no problem) but didn't the next day.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
When I did ssh-add:
$ ssh-add -l
The agent has no identities.
Is it possible that a key, which was previously loaded into SSH, is automatically unloaded?
The following fixed the issue (for reference):
ssh-add ~/.ssh/github_rsa
Enter passphrase for /Users/admin/.ssh/github_rsa:
Identity added: /Users/admin/.ssh/github_rsa (/Users/admin/.ssh/github_rsa)
The latest Github for (Mac|Windows) include a credential helper (as explained in "How to use git with gnome-keyring integration").
That means, if you need to enter a password (because your private ssh key is passphrase protected), that will be stored by git for the duration of the session.
But at the next session, you will need to enter the passphrase again (once).
On the mac, identities that you add don't usually go away unless you explicitly remove them (ssh-add -d), the machine is rebooted, or you log out and then log back in again.

Github configuration id_rsa password

For the github configuration, I have completed the steps of
1.) creating new SSH keys
2.) entering my id_rsa.pub key and thus adding the key
But during the testing stage of testing, after I entered
user$ ssh -T git#github.com
A new window (outside the terminal) opens up asking : Enter your password for "id_rsa". Where can I find this password. FYI, I am using a Mac OS 10.5.8
Even after I entered:
user$ ssh -vT git#github.com
The same new window opens up asking for the "id_rsa" password.
Please help.
While creating your ssh key in step 1), make sure to enter no passphrase for it. Otherwise the setup will be more complicated as you need to use something like ssh-agent to enter the password automatically for you.