Question

I'm trying to use the latest version SourceTree with a Google Code project that uses Git. The problem is that when I try pushing the changes, it complains about authentication:

git push -v --tags --set-upstream origin master:master
Pushing to [project]
fatal: remote error: Invalid username/password.
You may need to use your generated googlecode.com password; see https://code.google.com/hosting/settings
Completed with errors, see above

I can't see a place to enter in a password anywhere in the settings. I tried searching Atlassain's knowledge base and Google but I couldn't find anything relevant. The only clue comes from Google's project page which says:

Option 1: Get a local copy of the [project] repository with this command:
git clone [project]
To push your changes, authenticate with your Google Account and your generated googlecode.com password.
Option 2: Stay authenticated with .netrc:
Add the following to your .netrc.
machine code.google.com login [email] password [generated googlecode.com password]
Make sure the clone URL doesn't contain your username: git clone [url]

There's also another Google page which says:

For Git repositories, you can add the following line to your .netrc file recording your password for each repository domain you have commit access to. Make sure you have set the permissions on .netrc so that only your user account can read it.

machine code.google.com login [email] password [password]

This problem only started after I upgraded to the latest version of SourceTree. Is there any place in the GUI that I can enter in the authentication details? I believe that there was a GUI option in the old version, but I can't find it anymore. The only places I found that let you enter in something similar is in the Repository's advanced tab, or the General tab of the main preferences. However, in both instances, it only asks for an email address and not a password.

Was it helpful?

Solution

The problem is that by default Google tells (in .git/config) you to use a URL which includes the "USER@" portion. SourceTree sees this and assumes that the Username is the user in the URL and that there is no password. To fix the problem, simply remove the "USER@" portion in the URL. Then when you try pushing your changes, SourceTree will prompt for a username/password.

For example, instead of:

https://USER@code.google.com/p/PROJECT/

use:

https://code.google.com/p/PROJECT/

For more info, see: https://answers.atlassian.com/questions/36585/entering-in-a-password-in-sourcetree

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top