Git SSH keys

SSH keys are used to identify trusted computers without involving passwords. In this article we'll show you how to upload an existing key or generate a new pair, so you can use them to authenticate in your repositories on Buddy.

Warning
The default path to the keys and configuration file is ~/.ssh. The default name of the key is id_rsa. You can choose another name if you wish, but it must be reflected accordingly in the configuration.

Adding SSH keys in Buddy

  1. To configure Git SSH keys in Buddy, go to your profile details and click SSH Keys:

    Image loading...SSH Keys option on the profile dropdown menu

  2. Click the + icon and select whether you want to upload an existing key or generate a fresh pair:

    Image loading...Adding SSH keys to your Buddy profile

Depending on the chosen option, paste and upload your key, or generate a new pair:

Image loading...Key upload view

Image loading...Key generation view

Hint
Buddy will automatically upload the public key to the service – you don’t have to add it manually.

Generating SSH keys manually

  1. Fire up your console/terminal and type:

    bash
    ssh-keygen -t rsa -b 4096 -C "your_email@address" $$
  2. Press Enter when prompted to select the default file in which to save the key.
  3. (Optional) Type passphrase for higher security.
  4. Review the fingerprint (id) of your key and close the console.

Solving problems with SSH keys

Cannot clone or push/pull repository

If you’re not able to clone or push/pull from the repository, make sure you have configured everything according to the list below:

  1. The file ~/.ssh/config contains an entry with our service:

    Host app.buddy.works HostName app.buddy.works User buddy IdentityFile ~/.ssh/id_rsa
  2. Depending on your registration region, the SSH URL to your project looks like this:

    buddy@app.buddy.works:WORKSPACE/PROJECT buddy@eu.buddy.works:WORKSPACE/PROJECT
Danger
URLs in HTTPS format do not work.
  1. You have properly added the key to the ssh-agent:

    bash
    ssh-add ~/.ssh/id_rsa $$
  2. The remote address has been properly configured.
  3. The local repository folder contains a hidden .git directory with the config file. Make sure the file contains the following entry:

    [remote "origin"] url = buddy@app.buddy.works:WORKSPACE/PROJECT fetch = +refs/heads/*:refs/remotes/origin/*

Permission denied error

If you’re receiving the following error, it means that the key added to Buddy doesn’t match the key on your computer:

Permission denied (publickey,keyboard-interactive). fatal: The remote end hung up unexpectedly

Here’s what you should do:

  1. Go to your ~/.ssh folder and double-check if the public key in the folder is the same as the one in Buddy.
  2. Run this command to see if Buddy can authenticate properly with the keys: ssh buddy@app.buddy.works If everything’s alright, you’ll receive a response of this type:

    Hi there! You are good to go. Just start pushing and pulling :) Connection to buddy.works closed.
Hint
If you again fail to authenticate, it means that the keys still don’t match.
Tip
If you are 100% sure that the keys are the same and everything should work properly, please run ssh -vvv buddy@app.buddy.works and send the output to support@buddy.works.

Last modified on Sep 23, 2024