Is there any way to hide password from git response? Edited

While pushng local changes back to bitbucket server via https we sometimes get below response in case of denial through "Branch permission" restrictions:

[ERROR] remote: 
[ERROR] To https://username:password@git.mycompany.com/scm/ABC/xyz.git
[ERROR]  ! [remote rejected] 1.8 -> 1.8 (pre-receive hook declined)
[ERROR] error: failed to push some refs to 'https://username:password@git.mycompany.com/scm/ABC/xyz.git'

In this case the username/password that used for cloning the repo (or being used for pushing changes back) are shown in clear text. 

Is there a way to hide these from bitbucket server response as this becomes a huge concern in case of ci systems.

1 answer

0 vote
Jeff Thomas Atlassian Team Aug 25, 2017

Do you have the username/password set in the Remotes URL?

git remote -v

If so, you'd need to remove the password from the remote URL.

As an alternative you can look at using SSH which won't show any passwords.

Thanks Jeff for the response.

We are actually interacting with bitbucket server through Eclipse jgit API that internally uses https protocol with following format of clone URL:

https://username:password@git.mycompany.com/scm/ABC/xyz.git

IMO it's a bitbucket server behavior to include the username/password too in it's error response, if any, and the git client might not have much to influence.

It would be great if there's a way to configure the server so that the response is less verbose.

Jeff Thomas Atlassian Team Aug 29, 2017

This is not Bitbucket Server returning the username and password in the response. Bitbucket Server's response only includes the lines beginning with "remote:". The other lines are all by the Git client. You would see a similar behavior if you did the same set of actions on Bitbucket Cloud or Github where a push was rejected. 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

28,032 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you