How can I deploy repository to Firebase with SSH key?
Asked by maksim kolin:

Hi everybody.

I'm absolutely new to Bitbucket, exactly start from thanksgiving day.

I'm going to deploy project to Firebase.

Then I have a error that unable to access to repo with requested url return 403.

I'm user of repo, not owner.

Please help me everybody.

How can I deploy repository to Firebase with SSH key?

Do I need the owner's SSH key? or else?


Answers:
author: maksim kolin
body: Hi [@Caroline R](/t5/user/viewprofilepage/user-id/3934006) . Thanks for your kindness.

I set up SSH key, and then updated the remote URL to my repository to change the authentication to SSH before.

And then I'm going to deploy project of the repository by using pipeline as frontend.

I written file bitbucket_pipeline.yaml as follows:

```
image: atlassian/default-image:2

pipelines:

branches:

master:

 - step:

name: 'Build and Test'

script:

 - echo "Your build and test goes here..."

 - step:

name: 'Updation'

script:

 - echo "Pulling Latest code from the git"

 - ssh $CREDIBLED_PROD_SERVER_USER@$CREDIBLED_PROD_SERVER "cd credibled_app && git pull"

 - ssh $CREDIBLED_PROD_SERVER_USER@$CREDIBLED_PROD_SERVER "docker rm -f frontend && docker rmi frontend"

 - step:

name: 'Deployment'

script:

 - ssh $CREDIBLED_PROD_SERVER_USER@$CREDIBLED_PROD_SERVER "cd compose && docker-compose up -d frontend"

 - echo "Application deployed successfully"
```

I'd like to know why I can't my repository with SSH key, and how to repair this if there is a way.

I hope you are very helpful forward. I'm waiting.

Thanks.

From Maksim.

comments: author: Caroline R
body: Hi, Maksim!

Thanks for the additional information. We have the following guide on how to deploy to Firebase, which includes step by step instructions on how to use a pipe and a Firebase token to push:

* <https://support.atlassian.com/bitbucket-cloud/docs/deploy-to-firebase/>

If you prefer to stick to your approach and your YAML file, could you please confirm the following information:

* Which command gives you an error?

<!-- -->

* What is the output of the command that is failing, now that you switched to SSH?

* Can you access this server, $CREDIBLED_PROD_SERVER, outside of Pipelines? Either directly or via SSH from your machine? If so, can you try a git pull command in that directory directly from the server, and let us know what is the output then?

Please let me know how it goes and feel free to share any additional questions or concerns regarding this case.

Kind regards,  
Caroline


author: Caroline R
body: Hi, [@maksim kolin](/t5/user/viewprofilepage/user-id/4652261)! Welcome to the community!

By the error message you shared with us, I believe you were trying to use HTTPS to connect with your repository, is that correct? If that's the case, we [announced in June](https://bitbucket.org/blog/deprecating-atlassian-account-password-for-git-and-bitbucket-api-activity) that we are phasing out the use of user login passwords for REST APIs and git over HTTPS.

We [recently announced](https://bitbucket.org/blog/deprecating-atlassian-account-password-for-bitbucket-api-and-git-activity) the first phase of this, where any user with an Atlassian account created on or after UTC 00:00 on **13 September 2021** must use a Bitbucket Cloud generated [App Password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) for all git operations over HTTPS and for REST API authentication.

In this case, as you have recently created your account, you will need to use an App Password if you would like to use HTTPS. So I would ask you to please try to create and use an App Password and let me know if you have any problems using or configuring this, we will be happy to assist you.

However, if you want to use SSH to authenticate, you will need to first [Set up an SSH key](https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/), and then update the remote URL to your repository to change the authentication to SSH. You can follow the steps described in this doc to change the remote URL:

* [Change the remote URL to your repository](https://support.atlassian.com/bitbucket-cloud/docs/change-the-remote-url-to-your-repository/)

I hope this helps, but do let me know if you have any questions.

Kind regards,  
Caroline

comments: author: maksim kolin
body: Hi [@Caroline R](https://community.atlassian.com/t5/user/viewprofilepage/user-id/3934006) . Thanks for your kindness.  
I set up SSH key, and then updated the remote URL to my repository to change the authentication to SSH before.

And then I'm going to deploy project of the repository by using pipeline as frontend.

I written file bitbucket_pipeline.yaml as follows:

```
image: atlassian/default-image:2

pipelines:

branches:

master:

 - step:

name: 'Build and Test'

script:

 - echo "Your build and test goes here..."

 - step:

name: 'Updation'

script:

 - echo "Pulling Latest code from the git"

 - ssh $CREDIBLED_PROD_SERVER_USER@$CREDIBLED_PROD_SERVER "cd credibled_app && git pull"

 - ssh $CREDIBLED_PROD_SERVER_USER@$CREDIBLED_PROD_SERVER "docker rm -f frontend && docker rmi frontend"

 - step:

name: 'Deployment'

script:

 - ssh $CREDIBLED_PROD_SERVER_USER@$CREDIBLED_PROD_SERVER "cd compose && docker-compose up -d frontend"

 - echo "Application deployed successfully"
```

I'd like to know why I can't my repository with SSH key, and how to repair this if there is a way.

I hope you are very helpful forward. I'm waiting.

Thanks.

From Maksim.


Tags: bitbucket-cloud

bitbucket-pipelines

cloud