Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bitbucket Pipe push back to repo

Michael Russell
Contributor
May 30, 2019

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
Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 13, 2019

@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

Michael Russell
Contributor
September 13, 2019

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 

Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 13, 2019

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

Michael Russell
Contributor
September 13, 2019

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

Mateusz Przybyłek
Contributor
March 18, 2020

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
Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 19, 2020

@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
Poat
Contributor
September 9, 2021

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
0 votes
Brett Mathe July 1, 2019

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

Michael Russell
Contributor
July 12, 2019

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.

0 votes
Michael Russell
Contributor
May 30, 2019

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
AUG Leaders

Atlassian Community Events