# CD not accepting my SSH key

**URL:** <https://discuss.circleci.com/t/cd-not-accepting-my-ssh-key/19270>\
**Category:** Deployments\
**Created:** [January 10, 2018, 6:49pm UTC](https://discuss.circleci.com/t/cd-not-accepting-my-ssh-key/19270 "2018-01-10T18:49:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![celsoMartins](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/celsomartins/32/17593_2.png) [@celsoMartins](https://discuss.circleci.com/u/celsoMartins)\
**Post date:** [January 10, 2018, 6:49pm UTC](https://discuss.circleci.com/t/cd-not-accepting-my-ssh-key/19270/1 "2018-01-10T18:49:19Z")

</div>

Hi.

I’m getting an issue to deploy my code to my environments in the heroku system. Cirlcle CI is not getting as valid any of my SSH keys I’ve tried. I’ve tried the key I have on Heroku, my machine and even the github. I set up every fingerprint I have, combining with the config I have in the circle CI, but still not working. Locally I’m still able to push my code to heroku (production and staging), but Circle CI keeps to refusing my key. The documentation is too vague on this. I suggest an update there after you find the solution to my problem.

Example build: [https://circleci.com/gh/celsoMartins/swarga/103](https://circleci.com/gh/celsoMartins/swarga/103)

The error:

#!/bin/bash -eo pipefail  
git push --force [git@heroku.com](mailto:git@heroku.com):staging-swarga.git HEAD:refs/heads/master  
heroku run python [manage.py](http://manage.py) deploy  
heroku restart  
Warning: Permanently added ‘[heroku.com](http://heroku.com),50.19.85.132’ (RSA) to the list of known hosts.

Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights  
and the repository exists.  
Exited with code 128

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [January 25, 2018, 12:12am UTC](https://discuss.circleci.com/t/cd-not-accepting-my-ssh-key/19270/2 "2018-01-25T00:12:22Z")

</div>

Is this still an issue?

Have you added the host key fingerprint to your build config?

---

<div class="post-metadata">

**Author:** ![g105b](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/g105b/32/13561_2.png) [@g105b](https://discuss.circleci.com/u/g105b)\
**Post date:** [June 14, 2018, 10:30am UTC](https://discuss.circleci.com/t/cd-not-accepting-my-ssh-key/19270/3 "2018-06-14T10:30:38Z")

</div>

I’m having the same issue, and I’ve documented the process of adding the SSH key into CircleCI. I expect we’re both doing the same thing wrong, so hopefully my question will help you too.

> [@SSH connection from CircleCI build server to remote server not being allowed](https://discuss.circleci.com/t/ssh-connection-from-circleci-build-server-to-remote-server-not-being-allowed/22964?testtesttesttestset):
>
> I have had no problems making an SSH connection out from a CircleCI server to a remote Linux server. I use this for deployment, and now I’ve come to add another server to the “SSH Permissions” page of the settings but no connections can be made to the new server. Maybe the way I am generating SSH keys is not compatible with CircleCI? I’m using CircleCI 2.0. I’ve started from scratch again to make a note of all commands that are performed. Transcript as follows: ssh-keygen -t rsa -b 4096 -C "d…

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [September 12, 2018, 10:30am UTC](https://discuss.circleci.com/t/cd-not-accepting-my-ssh-key/19270/4 "2018-09-12T10:30:39Z")

</div>

Closed on September 12, 2018, 10:30am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
