Hi guys!
After a pull request on Azure DevOps, from a feature branch to master, my repository on Azure DevOps is now ahead of the bitbucket repository, and I need to sync them.
Problem is, I can't. I tried running the powershell script below on an Azure Pipeline, as per the link.
if ( $(git remote) -contains 'bitbucket' )
{
git remote rm bitbucket
echo 'remove remote bitbucket'
}
git remote add bitbucket https://username:password@bitbucket.org/username/repo.git
$branch="$(Build.SourceBranch)".replace("refs/heads/","")
git checkout $branch
git push bitbucket $branch -f But this is failing with the following error:
fatal: unable to access '<a href="https://bitbucket.org/***/repo.git/':">https://bitbucket.org/***/repo.git/':</a>; URL using bad/illegal format or missing URL
Any idea what I might be doing wrong? I copy pasted the script from the link, changing the username and password by the credentials I use to connect to my bitbucket account, and repo with the repository name.
EDIT
I was not encoding neither the username nor the password, and by changing that the pipeline is now executed until the end. However, as weird as it is, no change is being persisted on bitbucket. The powershell output is as follows:
Switched to a new branch 'master'
Branch 'master' set up to track remote branch 'master' from 'origin'.
Everything up-to-date
EDIT 2
Ok, I dug up the problem. Some data actually passed from Azure DevOps to bitbucket already: the first commit within the pull request. All other commits didn't go through.