Create
cancel
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

Pipeline git-ftp sftp SSH keys convert to PEM

Edited

I was trying use git-ftp for deplyment via SFTP.

1) default git-ftp does not support sftp, so I use some updated image with madshansen/docker-git-ftp:latest with libssh2 and some specific version of curl

2) at the pipeline configuration, I create SSH key, if I understand, the path to the key is ~/.ssh/config

3) at the yaml file I have this script:

git ftp push --auto-init --insecure -vv -u $USERNAME --key ~/.ssh/config sftp://$SERVER --remote-root /var/www/doman.tld

git-ftp return:

+ git ftp push --auto-init --insecure -vv -u $USERNAME --key ~/.ssh/config sftp://$SERVER --remote-root /var/www/
Mon Sep 14 17:45:42 UTC 2020: git-ftp version 1.3.3 running on Linux 6936dbbe-64ba-44d4-a3d2-8b0d52b4796c-fhcj8 4.19.128-flatcar #1 SMP Tue Jun 16 10:17:17 -00 2020 x86_64 x86_64 x86_64 GNU/Linux
Mon Sep 14 17:45:42 UTC 2020: Auto init if needed.
Mon Sep 14 17:45:42 UTC 2020: Insecure SSL/TLS connection allowed
Mon Sep 14 17:45:42 UTC 2020: Host is 'domain.tld'.
Mon Sep 14 17:45:42 UTC 2020: User is 'disruptive'.
Mon Sep 14 17:45:42 UTC 2020: No password is set.
Mon Sep 14 17:45:42 UTC 2020: Using ssh private key file /root/.ssh/config
Mon Sep 14 17:45:42 UTC 2020: Using ssh public key file /root/.ssh/config.pub
Mon Sep 14 17:45:42 UTC 2020: Path is '/var/www/'.
Mon Sep 14 17:45:42 UTC 2020: Syncroot is ''.
Mon Sep 14 17:45:42 UTC 2020: The remote sha1 is saved in file '.git-ftp.log'.
Mon Sep 14 17:45:42 UTC 2020: CACert is ''.
Mon Sep 14 17:45:42 UTC 2020: Insecure is '1'.
Mon Sep 14 17:45:42 UTC 2020: Retrieving last commit from sftp://disruptive:***@domain.tld//var/www/.
* Trying 0.159.135.70...
* TCP_NODELAY set
* Connected to domain.tld (0.159.135.70) port 22 (#0)
* SSH MD5 fingerprint: *******
* SSH authentication methods available: publickey
* Using SSH public key file '/root/.ssh/config.pub'
* Using SSH private key file '/root/.ssh/config'
* SSH public key authentication failed: Unable to open public key file
* Failure connecting to agent
* Authentication failure
* Closing connection 0
curl: (67) Authentication failure
Mon Sep 14 17:45:43 UTC 2020: Check if sftp://disruptive:***@domain.tld is accessible.
* Trying 0.159.135.70...
* TCP_NODELAY set
* Connected to domain.tld (18.159.135.70) port 22 (#0)
* SSH MD5 fingerprint: *******
* SSH authentication methods available: publickey
* Using SSH public key file '/root/.ssh/config.pub'
* Using SSH private key file '/root/.ssh/config'
* SSH public key authentication failed: Unable to open public key file
* Failure connecting to agent
* Authentication failure
* Closing connection 0
curl: (67) Authentication failure
Mon Sep 14 17:45:44 UTC 2020: fatal: Can't access remote 'sftp://disruptive:***@domain.tld 

 

In the end, it looks that parameter --pubkey is required and the private key is not readable from bitbuckeg path .ssh/config or it is in a different format.

With pem and pub generate via ssh-keygenit it works.

1 answer

1 accepted

1 vote
Answer accepted
Dario B Atlassian Team Jan 28, 2021

Hello @Ladislav Janeček,

I can see you had a support request open for this same issue (BBS-146071) that has been closed on the 9th of October for no reply, after the below message was sent to you:

In this case, would it be possible for you to try to use the below path for the private SSH key on Pipelines?

 

/opt/atlassian/pipelines/agent/ssh/id_rsa
git ftp push --auto-init --insecure -vv -u $USERNAME --key /opt/atlassian/pipelines/agent/ssh/id_rsa sftp://$SERVER --remote-root /var/www/doman.tld

 

If the issue still persists, try to add your credentials as part of the .git/config file on Pipelines.
Reference: https://github.com/git-ftp/git-ftp/issues/313#issuecomment-271265267

Let me know how it goes, Ladislav.

 

Can you kindly clarify whether this solved your issue or if further help is needed? 

 

 

Cheers,
Dario

Hello, yes, the problem was solved, thank you.

Like Dario B likes this
Dario B Atlassian Team Jan 29, 2021

Thanks a lot for confirming @Ladislav Janeček . 

Enjoy the weekend! :) 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
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...

117 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