Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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
4,644,716
Community Members
 
Community Events
196
Community Groups

git ftp push Pipeline failing "SSH public key authentication failed: Unable to open public key file"

Edited

I try to make git ftp push pipline work from bitbucket to aws lightsail with a bitnami image. I followed the steps here, but cannot find my error:

https://community.atlassian.com/t5/Bitbucket-questions/Pipeline-git-ftp-sftp-SSH-keys-convert-to-PEM/qaq-p/1480543

my yml file looks like this:

 

image: php:7.3.5

pipelines:
branches:
master:
- step:
name: Deploy to aws lightsail bitnami production
deployment: production
script:
- apt-get update
- apt-get -qq install git-ftp
- apt-get install -y ssh
- git ftp push -vv -u bitnami --key /opt/atlassian/pipelines/agent/ssh/id_rsa sftp://x.x.x.x:22/opt/bitnami/wordpress/wp-content

A connection is made, but it seems the public key cannot be found. I created a SSH Pipline key and a fingerprint in repro settings->pipeline.

And I copied the public key to the home/bitnami/.ssh/authorized_keys file with nano.

PS:

I answered my question myself. Still I wonder where the public key is. The solution I found just recreates the public key - can this be on purpose? So if anybody knows the internals, I would be very interested what the path of the public key is. I revert my mark as answer so somebody still gets the credits if answerting.
Thanks!

The exact error message is here:

+ git ftp push -vv -u bitnami --key /opt/atlassian/pipelines/agent/ssh/id_rsa sftp://x.x.x.x:22/opt/bitnami/wordpress/wp-content
Mon Oct 25 11:10:55 UTC 2021: git-ftp version 1.3.1 running on Linux xxxxxxxxxxxxxxxxx-ffdnv 5.6.0 #1 SMP Thu Nov 12 07:09:22 UTC 2020 x86_64 GNU/Linux
Mon Oct 25 11:10:55 UTC 2021: Host is 'x.x.x.x:22'.
Mon Oct 25 11:10:55 UTC 2021: User is 'bitnami'.
Mon Oct 25 11:10:55 UTC 2021: No password is set.
Mon Oct 25 11:10:55 UTC 2021: Using ssh private key file /opt/atlassian/pipelines/agent/ssh/id_rsa
Mon Oct 25 11:10:55 UTC 2021: Using ssh public key file /opt/atlassian/pipelines/agent/ssh/id_rsa.pub
Mon Oct 25 11:10:55 UTC 2021: Added missing trailing / in path.
Mon Oct 25 11:10:55 UTC 2021: Path is 'opt/bitnami/wordpress/wp-content/'.
Mon Oct 25 11:10:55 UTC 2021: Syncroot is ''.
Mon Oct 25 11:10:55 UTC 2021: The remote sha1 is saved in file '.git-ftp.log'.
Mon Oct 25 11:10:55 UTC 2021: CACert is ''.
Mon Oct 25 11:10:55 UTC 2021: Insecure is ''.
Mon Oct 25 11:10:55 UTC 2021: Retrieving last commit from sftp://bitnami:***@3.125.44.139:22/opt/bitnami/wordpress/wp-content/.
* Trying x.x.x.x...
* TCP_NODELAY set
* Connected to x.x.x.x (x.x.x.x) port 22 (#0)
* SSH MD5 fingerprint: xxxxxx
* SSH authentication methods available: publickey
* Using SSH public key file '/opt/atlassian/pipelines/agent/ssh/id_rsa.pub'
* Using SSH private key file '/opt/atlassian/pipelines/agent/ssh/id_rsa'
* 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 Oct 25 11:10:56 UTC 2021: fatal: Could not get last commit. Network down? Wrong URL? Use 'git ftp init' for the initial push., exiting...

1 answer

I continued to work on it and found another post in related community content:

https://community.atlassian.com/t5/Bitbucket-Pipelines-questions/Git-FTP-not-finding-pipeline-SSH-key/qaq-p/1756484

This worked - I used the bitbucket repo settings->ssh keys to generate a new public and private key. Then copied the private key from bitbucket to .ssh/authorized_keys; do not delete the public key inside there, it is needed by Aws and other tools you connect with.

Funny I was not able to find the post above - as usual understanding grows while working on the topic; including the right wording. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events