Unable to push the code to repository

Gopi September 19, 2023

Hi Team,

 

We are trying to synchronize the repository changes from Azure repo to Bitbucket repo with same project and repo name.

 

Steps we followed:

 

  1. Created a one repo in Azure by name ‘sync’
  2. Created a same repo in Bitbucket cloud trail version.
  3. And added a mirror pipeline In yml into azure repo to trigger each commit changes to Bitbucket
  4. Now we with the pipeline we are able to clone the repo from azure and trying to push but failing with below error.

 

 error.png

Connections:

  1. We have added the personal access token in both Azure and Bitbucket
  2. We have mapped the service connections in azure to map the bitbucket repo to Azure.
  3. Lastly enabled webhooks and added the repo link and given user credentials via PAT (personal access token)

 

 

Please help us to push and sync the azure repo with bitbucket repo.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 20, 2023

Hi @Gopi and welcome to the community!

Based on the output, it looks like an app password is not provided in the Bitbucket repo's URL, so the process fails because it cannot give a prompt for you to enter a password.

 

  • What type of authentication do you want to use to push to the Bitbucket repo?
  • And what URL have you specified for the Bitbucket Cloud repo?

 

If you want to use username and app password, please make sure that the Bitbucket repo URL looks like this:

https://{bitbucket_username}:{app_password}@bitbucket.org/{workspace}/{repository}.git

where

{bitbucket_username} is the Bitbucket username of the account you generated the app password for, it can be found here https://bitbucket.org/account/settings/ after you log in to the account
{app_password} is an app password for the Bitbucket user you are authenticating with

 

If you want to use a repository access token, please ensure that the Bitbucket repo URL looks like this:

https://x-token-auth:{repository_access_token}@bitbucket.org/{workspace}/{repository}.git

where

x-token-auth is a literal string, you don't replace this with anything
{repository_access_token} is the value of the repository access token

For variables like {app_password} and {repository_access_token}, we recommend storing them in secured variables, if Azure offers this option.

Please feel free to reach out if you have any questions!

Kind regards,
Theodora

Gopi September 28, 2023

Hi Theodora,

Thank you so much for the reply, we tried both the ways , still we are faing some issues and that URL issue is still persisit.

pleas have a look on attached screenshots.

 

 

Regards,

GopiScreenshot.JPGScreenshot2.JPG

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 29, 2023

Hi Gopi,

I see the following in the second screenshot you posted:

  • You are using an email address as username. Email addresses cannot be used for authentication when you clone, pull, or push to Bitbucket repos. It needs to be the Bitbucket username, which you can find here https://bitbucket.org/account/settings/ after you log in to the account you are authenticating with.

  • You also need to remove the curly brackets around the username and the app password. So, if the value of the username is myusername and the value of the app password is ABCDEFG, the URL needs to be
https://myusername:ABCDEFG@bitbucket.org/workspace/repository.git

I cannot see what is wrong in the first screenshot as the token is masked. However, if you enclosed the access token in curly brackets as well, this must be the culprit. You will need to remove any curly brackets from the access token.

I hope this helps, please feel free to let me know how it goes.

Kind regards,
Theodora

Gopi October 10, 2023

Hi Theodora,

Thank you so much for the reply, we tried both the ways , still we are faing some issues and that URL issue is still persisit again and again.

pleas have a look on attached screenshots.Screenshot2.JPGScreenshot.JPG

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 10, 2023

Hi Gopi,

In the first screenshot, I see that you are still using an email for authentication in the URL, instead of a Bitbucket username, and there are also curly brackets. Please see my previous reply for an example, you will need to use a Bitbucket username instead of an email address and you also need to remove the curly brackets around the username and the app password.

For the second screenshot, the part after https://x-token-auth: in the URL is displayed as asterisks.

Are you using some variable for the access token that is masked in the log?
If so, does the value of this variable include brackets as well? If it includes brackets or spaces, please make sure to remove the brackets or spaces from the variable value.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events