HTTP authentication failure on push

Running on Windows 7.

I have a bare repository at http://locode01:8080/scm/git/hpmis_calc_engine and a local clone.

When I try to push from my clone I am asked for my password: the username box is pre-populated with the name of the repository host 'locode01'. Naturally, this push fails.

The full output for the push command is:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master
Pushing to http://locode01:8080/scm/git/hpmis_calc_engine

fatal: Authentication failed

Pushing to http://locode01:8080/scm/git/hpmis_calc_engine

fatal: Authentication failed

Pushing to http://locode01:8080/scm/git/hpmis_calc_engine

The same repository pushes correctly when using TortoiseGIT, GIT cli, etc. - in each case I am asked for the username and password.

How do I specify the HTTP authentication username in Sourcetree?

1 answer

1 accepted

This widget could not be displayed.

You can specify the username just by pre-pending it to the url like this:

https://username@host/path/to/repo

However when I test a https URL here without specifying the username, I get prompted for the username too. The way ST does this is it checks to see if the prompt from git asks for the username or just the password, so I'm not sure why it's getting that wrong. Will tryt o reproduce.

Ok, so the problem is that when you include the port in the URL a username is incorrectly derived from the hostname. It doesn't happen if the port is standard. Logged as a bug: https://jira.atlassian.com/browse/SRCTREEWIN-415

I've also confirmed that adding the username to the URL as shown above works around the problem in the mean time.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

861 views 2 3
Read article

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