git push fails with ssh key not found and error message is out of date

Hey,

It’s been a few years since I’ve worked with Balena, so I’m still doing things the old way with git push. I my balena user name is jason10 but my github account is under drjasonharrison. I suspect that I after I imported keys from github I need to configure my ~/.ssh/config to help with the username.

Here’s the error message I get

Warning: Permanently added the ECDSA host key for IP address '3.221.16.120' to the list of known hosts.

	############################################################################

	None of the supplied SSH keys matched a known key for user `jason10`

	Known ssh key fingerprints for `jason10`:
		* 5813566518050886f8c87a1b5020526d
		* fac74f3a74f24a353ac14fc13d23a5b0

	Please make sure you've configured your keys correctly.
	https://balena.io/docs/getting-started/#adding-an-ssh-key

	############################################################################

jason10@git.balena-cloud.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Note that the webpage gets redirected to Get started with Raspberry Pi 3 and Node.js - Balena Documentation which now discusses using the Balena CLI.

Is there a webpage that discusses the ~/.ssh/config for balena? Couldn’t find it in the docs or through google (with site:balena.io/docs). Will probably have to hit stackoverflow.

1 Like

Hello @jason10 thank you for your message!

I contacted with the CLI team to solve the Link issue. The correct URL (if i’m not wrong) might be https://www.balena.io/docs/learn/manage/ssh-access/#add-an-ssh-key-to-balenacloud

On the other hand, related with the current issue i understand that you are deploying a project from a drjasonharrison repo. And of course, you introduced your github public key from drjasonharrison on balenaCloud, right? could you please check on Settings > SSH keys here?

Not sure you need anything else. Confirm me this, and i will try to reproduce myself :slight_smile:

@jason10 i tried to reproduce and it worked on my side!

Could you also confirm the git remote add balena that you used?

Hello @jason10 could you please confirm if this is now working for you?

Thank you :slight_smile:

Hi Marc,

The corrected URL appears to be correct.
My balena account has an email of drjasonharrison but balena username jason10
I would have used the provided command from the “add release” dialog:

git remote add balena jason10@git.balena-cloud.com:jason10/sit-stand-desk-rpi3.git

1 Like

@jason10 after speaking with a colleague it looks like this is balena’s fault when this is run from specific OS. Out of curiosity are you running Fedora or similar?

Our temporary workaround that can be used while a definitive solution does not yet exist:

  • Either add PubkeyAcceptedKeyTypes +ssh-rsa to SSH configuration
  • or prefix your git commands with GIT_SSH_COMMAND="ssh -vvvv -oPubkeyAcceptedKeyTypes=+ssh-rsa" git push balena
  • or use a different algorithm for the key ( ecdsa or ed25519 should work fine)

Change .ssh/config to refer to the custom named identify file? e.g. id_balena / id_balena.pub

Let us know if that works! Thank you for your patience!

@mpous thanks. I’m on macOS 11.6.
SSH: OpenSSH_8.1p1, LibreSSL 2.7.3
GIT: git version 2.33.0

The balena cli is working fine, I will try your suggestions and let you know eventually.

Added this to my ~/.ssh/config file

Host git.balena-cloud.com
    HostName git.balena-cloud.com
    User jason10
    IdentityFile ~/.ssh/github_id_rsa