Git - Push From GUI Client Returns "Authentication Failed"

Abstract

In this article, we will show how to properly configure access of your third party Git Gui client like SourceTree, GitHub Desktop, MeGit/EGit to remote repositories like GitHub and Bitbucket.

1 Problem

When using third party Git Gui, you might encounter a problem with setting authentication. Typically, that will manifest itself in this way: Git push to GitHub from the third party client results in "Authentication Failed." This situation can happen with Git clients SourceTree, GitHub Desktop, MeGit/EGit with remote repositories GitHub and Bitbucket. It does not necessarily happen in all combinations, but I have seen it in several of them.

1.1 Problem on MeGit

I will demo the problem with screens from MeGit, but it will happen with other Git Gui clients.

So, after you try to push, you get a message:

Then you are prompted for the credentials.

Enter your GitHub account name and password. But, it will NOT work. You will again be presented with the same message: “Not authorized.”

1.2 Problem in SourceTree

Here is the way the same situation looks in the SourceTree application:

Then you enter your account name and password. But it does NOT work. You are again presented with the same message: “Not authorized”

2 Solution

You are not entering the proper password here, because it is not the GitHub account password they want here. You need to generate an “access token."

2.1 Generating Access token on GitHub

Here are a couple of screens that will help you to create a token at GitHub:

Once you get the access token, enter it as a password together with your GitHub account name to your third party Git Gui.

2.1 Generating Access token on Bitbucket

The analogous process is on Bitbucket site. Here are a couple of screens to help you.

Again, once you get the access token, enter it as a password together with your Bitbucket account name to your third party Git Gui.