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,296,601
Community Members
 
Community Events
165
Community Groups

Bitbucket Pipe push back to repo

Edited

I've been able to `git push ...` in Pipeline scripts for awhile now, however, I'm moving over to using the new "Pipe" variant of deployments and I'm finding it impossible to push updates back to the same repo.

Is this only supported in Pipelines and not Pipes

 

I receive the following error:

`fatal: unable to access 'http://bitbucket.org/username/the_repo_name/': Failed to connect to localhost port 29418: Connection refused`

3 answers

1 accepted

1 vote
Answer accepted

@Michael Russell @Brett Mathe you can use the git auth proxy feature from withing the pipe. All you have to do is to add the following line somewhere in your script:

git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://host.docker.internal:29418/

This will route git traffic from the docker container to the same git auth proxy that is used to authenticate git push commands in pipelines. Make sure you use the BITBUCKET_GIT_HTTP_ORIGIN as your git origin as well. 

More info about pushing back to a repo from pipelines: https://confluence.atlassian.com/bitbucket/push-back-to-your-repository-962352710.html

Will that port always be the same? And if so, can we get this in the confluence doc you linked to as methods to push from a "Pipe" specifically; I read through that which lead me to the whole auth string bit but took a moment to get there.

This was a bit of a time sink for myself with no straight documentation on the internal workings of Pipes and git push back. It makes sense when you dig in, it was just bump in time when I was porting things over to Pipes.

 

Thanks for the feed back @Alexander Zhukov 

The host and port should be the same. We'll consider adding this to a confluence doc after we discuss this internally. 

OK, thanks @Alexander Zhukov it seems between your method, which appears to be what happens during build setup or using the BB auth string is the way to go.

Hopefully you all can get something on the docs for this :)

Thanks

Unfortunatelly doesn't work, error messgae:

Could not resolve proxy: host.docker.internal

 Pipeline:

git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://host.docker.internal:29418/
git tag test
git push origin

@Mateusz Przybyłek this approach is for pushing from a pipe. If you wan't to push from a pipeline, you should set the proxy to 'localhost' instead:

 

git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/

See this page for more details about pushing back from pipelines https://confluence.atlassian.com/bitbucket/push-back-to-your-repository-962352710.html 

Like Poat likes this

THANK YOU!  I also took a huge hit to productivity as we switched from pipelines to pipes.

My issue is that in my yml I was calling a BB pipe - and then running `git` commands after.  The BB pipe had switched my git.config as part of it's tasks - https://bitbucket.org/atlassian/bitbucket-pipe-release/src/master/pipe/scripts/git-commit.sh

Adding 

git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/

after I ran the BB pipe reset my git.config so it works again. YAY

Like Oleksandr Kyrdan likes this

I'm running into this issue too.  Did you have to setup OAuth to get this to work?

I just do the above in my comment, you can make a BB_AUTH_STRING via instructions here https://confluence.atlassian.com/bitbucket/deploy-build-artifacts-to-bitbucket-downloads-872124574.html

 

It's basically just a username/app-password mash up.

My current work around is to do `git remote set-url origin "https://${BB_AUTH_STRING}@Bitbucket.org/${BITBUCKET_REPO_FULL_NAME}.git"` would be amazing for Pipes to work the same way as Pipelines.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,198 views 2 9
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