Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Username error when pushing commits to branch

Emre Toptancı _OBSS_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 19, 2017

I am getting a curious error message when trying to push commits to BitBucket. Google search did not yield any results so I hope someone in the community can help me.

We have several branches but the ones important here are Master and Branch1. Branch1 was branched from Master a few weeks ago. Now I want to merge Branch1 back into Master. I will do this with a Pull Request from Branch1 to Master but since lots of changes (by other users) from other branches were pushed to Master in the meantime, I first pulled the changes on Master onto Branch1.

Most files did not cause problems but there were conflicts on a few (as expected). I manually resolved the conflicts on Branch1 and committed them. No problem so far.

When I try to push my changes to BitBucket, I get the error below.

git.exe push --progress "origin" branch1:branch1

Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 868 bytes | 0 bytes/s, done.
Total 7 (delta 4), reused 0 (delta 0)
remote: Your Git username should be same with your Atlassian username. Username on git config (john.doe) is not same with the username on Stash (adam.smith)
To https://adam.smith@myserver/bitbucket/scm/ateam/my-repo.git
! [remote rejected] branch1 -> branch1 (pre-receive hook declined)
error: failed to push some refs to 'https://adam.smith@myserver/bitbucket/scm/ateam/my-repo.git'

As I said, Google search for the error message did not yield any results. I cannot understand what is going wrong.

Can anyone tell me what I am doing wrong and how I fix it?

1 answer

0 votes
Julius Davies _bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2017

The key error message in all of that is this:

"Your Git username should be same with your Atlassian username. Username on git config (john.doe) is not same with the username on Stash (adam.smith)"

That probably means the free Verify Committers add-on is installed, or the author checking logic of the free Yet Another Commit Checker (YACC) add-on is enabled.

Two solutions:

1.  Adjust your local git config so your username matches the one Bitbucket knows, and then redo all the commits with bad username before pushing.

2.  Temporarily disable the hook from the Verify Committers add-on for your repo, or uncheck that setting in the YACC add-on if that's the culprit.

 

I recommend approach #1, since there's probably a reason author validation is turned on for your repository. 

p.s.  I maintain a competing add-on (Bit-Booster - Global Git and JIRA Hook) that is also able to protect repositories against commits with bad usernames.   You might like it - the error messages are a little better:

remote: -----
remote: Commit e4d06580fc0024e rejected.
remote:
remote: Author "G. Sylvie Davies <sylvie@bit-booster.com>" is not known to Bitbucket.
remote:
remote: Please either have an admin create the Bitbucket user record, or adjust
remote: your git config and amend (or rebase) the problematic commit(s).
remote: -----

 

Emre Toptancı _OBSS_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
October 19, 2017

Thank you for the answer. I asked our BitBucket admin to see if these plugins are installed. Waiting for the answer.

On the other hand I am still not sure why this happens. I have been using BitBucket for months and never faced this issue before. Same server, same user, same user PC. It is only me that works on my PC so I do not understand the name of another user is involved here. I am pretty much sure that I am not trying to commit with some other user's name.

Maybe it has something to do with Conflict Resolution because my use so far was with little branches that were merged in a few days. I didn't have to resolve large scale commit conflicts before.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events