1

I'm using a git bare repository for managing dotfiles, and some other repositories for custom DWM build and all. I use SSH for pushing and pulling from git, but it keeps asking me my SSH passphrase every time try to push or pull. i have already tried

eval $(ssh-agent)

then

ssh-add ~/.ssh/id_rsa

and its added successfully, but no luck I am missing something?

apoorv569
  • 51
  • 1
  • 8
  • you set your public key in git ? configure git user using `git config` ? – Archemar Jun 23 '20 at 09:06
  • Yes I my pasted my public key `id_rsa.pub` to gitlab -> settings -> SSH keys and i did `config config --global user.name "apoorv569"` and `config config --global user.email "[email protected]"` and for other repositories also i did the same but `git config` instead of `config config`. `config` is aliased to `config='/usr/bin/git --git-dir=/home/apoorv/dotfiles --work-tree=/home/apoorv'` as mentioned here - https://www.atlassian.com/git/tutorials/dotfiles – apoorv569 Jun 23 '20 at 09:13
  • and you use aliased `config` to pull/push files also ? (well obviously, either you would have been rejected from git) – Archemar Jun 23 '20 at 09:33
  • yes for dotfiles I use the alias `config` and for other repositories, i cd into the folder and use regular `git` – apoorv569 Jun 23 '20 at 09:39
  • Maybe [this post](https://unix.stackexchange.com/questions/26371/ssh-prompts-for-password-despite-ssh-authorized-keys) could be related. Cross site: [Git keeps prompting me for a password](https://stackoverflow.com/questions/7773181/git-keeps-prompting-me-for-a-password?page=1&tab=trending#tab-top) on Stackoverflow or [How to make git not prompt for passphrase for ssh key?](https://superuser.com/questions/1010542/how-to-make-git-not-prompt-for-passphrase-for-ssh-key) on Superuser – Cadoiz Sep 14 '22 at 13:52

1 Answers1

0

I may be mistaken but if you set a passphrase when you set up the ssh keys then you always will need to enter it. The passphrase encrypts the private key so if it is compromised it still can't be used without knowing the passphrase.

user103944
  • 376
  • 1
  • 4
  • so there is no way, i can store this passphrase somewhere or make it remember that its me, so i don't have to enter the passphrase every time i want to push or pull. someone told me that its possible. – apoorv569 Jun 23 '20 at 16:51
  • See if your OS has or supports ssh-agent. You might be able to use that to auto enter the passphrase. – user103944 Jun 25 '20 at 11:47
  • original post already state that, I have already tried using `eval $(ssh-agent)` and `ssh-add ~/.ssh/id_rsa` – apoorv569 Jun 25 '20 at 14:17
  • When the ssh-add is done does it ask for your passphrase? – user103944 Jun 27 '20 at 11:54
  • When I ran the command `ssh-add` for the first time, it asked `Enter passphrase for /home/apoorv/.ssh/id_rsa:`, after that it said, `Identity added: /home/apoorv/.ssh/id_rsa ([email protected])`, then I also double checked `ssh-add -l` to list all added identities, and there was the one that I added. – apoorv569 Jun 27 '20 at 16:05
  • That seems like it should work. Afraid the only other way I can think of is to re-generate the ssh keys without a passphrase. – user103944 Jun 28 '20 at 21:13
  • Is there something that I need to add to `~/.ssh/config` maybe? – apoorv569 Jun 28 '20 at 23:50