<p>You can try adding your passphrase to the keychain using <code>ssh-add -K</code>, this will ask you the passphrase for the first time and later on it won't ask.</p>

CC BY-SA 4.0
2021-11-26T04:23:34.087Z
2021-11-26T04:23:34.087Z
AV Reddy
<p>Passphrase is defined by the way you created your private key. When creating a key pair you need to opt for no passphrase on the private key - this should solve your issue.</p>

CC BY-SA 4.0
2021-11-26T03:02:06.293Z
2021-11-26T03:02:06.293Z
taleodor
<p>I'm playing around with a personal GitLab account to get familiar with its' ins and outs. First, I followed <a href="https://docs.gitlab.com/ee/ssh/" rel="nofollow noreferrer">this primer</a> on setting ssh keys and added public and private ED25519 keys to <code>~\.ssh</code>. I added the public key to my GitLab account. Then, using the <code>glab</code> CLI I was able to set up a repository which I could push to and pull from using <code>git</code>.</p>
<p>Unfortunately, <code>git</code> still prompts me for my SSH passphrase every time I try to push to the repo. I tried the following:</p>
<ul>
<li>Adding <a href="https://docs.gitlab.com/ee/user/gitlab_com/#ssh-known_hosts-entries" rel="nofollow noreferrer">known hosts entries</a></li>
<li><a href="https://docs.gitlab.com/ee/ssh/#verify-that-you-can-connect" rel="nofollow noreferrer">Verifying that I could connect</a> using <code>ssh -T https://gitlab.com/my_username</code></li>
</ul>
<p>The known host entries didn't have any noticeable effect on this behavior. Verifying I could connect threw the following error:</p>
<blockquote>
<p>ssh: Could not resolve hostname <a href="https://gitlab.com/my_username" rel="nofollow noreferrer">https://gitlab.com/my_username</a></p>
</blockquote>
<p>Why is <code>git</code> asking me to provide my passphrase every time I push and how can I fix this once and for all?</p>

<gitlab><git><ssh>
Git keeps asking for ssh passphrase when SSH is already defined in GitLab
user32882
# Git keeps asking for ssh passphrase when SSH is already defined in GitLab

(Asked by: username_0 on 2021-11-25)

I'm playing around with a personal GitLab account to get familiar with its' ins and outs. First, I followed [this primer](https://docs.gitlab.com/ee/ssh/) on setting ssh keys and added public and private ED25519 keys to `~\.ssh`. I added the public key to my GitLab account. Then, using the `glab` CLI I was able to set up a repository which I could push to and pull from using `git`.

Unfortunately, `git` still prompts me for my SSH passphrase every time I try to push to the repo. I tried the following:

* Adding [known hosts entries](https://docs.gitlab.com/ee/user/gitlab_com/#ssh-known_hosts-entries)
* [Verifying that I could connect](https://docs.gitlab.com/ee/ssh/#verify-that-you-can-connect) using `ssh -T https://gitlab.com/my_username`

The known host entries didn't have any noticeable effect on this behavior. Verifying I could connect threw the following error:

> ssh: Could not resolve hostname <https://gitlab.com/my_username>

Why is `git` asking me to provide my passphrase every time I push and how can I fix this once and for all?

**Tags:** gitlab, git, ssh


---

## 2 answers

### Answer by username_1 on 2021-11-26. Score: 5

You can try adding your passphrase to the keychain using `ssh-add -K`, this will ask you the passphrase for the first time and later on it won't ask.


---

### Answer by username_2 on 2021-11-26. Score: 1

Passphrase is defined by the way you created your private key. When creating a key pair you need to opt for no passphrase on the private key - this should solve your issue.


---

