Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Git FTP not finding pipeline SSH key


Hi, i've been trying to get a pipeline working which uses SSH keys and Git FTP. Past 2 days i've gotten the same error:

SSH public key authentication failed: Unable to open public key file

I've tried changing the path, checked the keys, etc. I don't know how to actually access the keys and get the correct path for the pipeline to be able to find them. I've tested this locally in VS-code by specifying the path to the keys which are stored on my computer, and that does seem to work. Why i can not access the SSH key that i configured in the repository settings is beyond me.

I've searched everywhere and found that the pipeline doesn't know what to do with ~/. If someone could provide me the actual path i'm supposed to use to grab the keys, that would be great.

My current pipeline file:

image: node:15.12.0

node: wp-content/themes/webpack/node_modules
- step:
name: Install node & deploy to production
- apt-get update -y
- apt-get install -y ssh
- apt-get install -y libssh2-1-dev
- apt-get -qq install git-ftp
- ls -a /opt/atlassian/pipelines/agent/ssh/
- ls -a ~/.ssh/config
- git ftp push -vv --insecure -u $USER --key /opt/atlassian/pipelines/agent/ssh/id_rsa --pubkey /opt/atlassian/pipelines/agent/ssh/ sftp://$SFTP_URL

1 answer

1 accepted

1 vote
Answer accepted

Hi @Dylan ten Donkelaar,

The SSH key should be located at


Could you please check if you can connect to your server using the path above?

I'll check with my team internally to see if there have been any changes, as I see that the path mentioned in our docs is ~/.ssh/my_ssh_key.

Kind regards,

Hi @Theodora Boudale

Thank you for replying. The public key is indeed in that location. I've checked with ls -la /opt/atlassian/pipelines/agent/ssh, returning a id_rsa and a id_rsa.tmp. Git-ftp still can not seem to find it.

I've also checked the ~/root/.ssh/config for the private key file but there's no key to be found there, even though the SSH-key settings in the repo say that a default identity of the private key is supposed to be in that folder.

Hi @Theodora Boudale

Our hosting provider just helped me find the solution.

The following lines did the trick:

- ssh-keygen -y -f /opt/atlassian/pipelines/agent/ssh/id_rsa > /tmp/
- git ftp push -vv --insecure -u $USER --key /opt/atlassian/pipelines/agent/ssh/id_rsa --pubkey /tmp/ sftp://$SFTP_URL

I will keep this thread just in case anyone else stumbles upon the same issue.

Like Theodora Boudale likes this

Hi @Dylan ten Donkelaar,

Thank you for posting this for future reference for other users.

I just wanted to add here some notes as well for clarification:

It's actually the public key that cannot be found, /opt/atlassian/pipelines/agent/ssh/id_rsa is the path of the private SSH key.

The command you included from your hosting provider

- ssh-keygen -y -f /opt/atlassian/pipelines/agent/ssh/id_rsa > /tmp/

generates the public SSH key from the private one and stores it in /tmp/, so you can use it as an argument in the git ftp command.

Another way to solve this would be to copy the public key from Repository settings > SSH keys and include the following command in the yml file:

- echo "paste_public_key_here" >> /tmp/

Kind regards,

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events