Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

110 views 2 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you