10

I am student, and very new to version control software so I am having trouble figuring this out. I am using a Google code Git repository. To access this repository I am using Git Bash on Windows 7. The problem is that when I reach the push step, I am not being prompted for a password. For example:

First I set global variables like this:

git config --global user.name "Your Name"
git config --global user.email youremail@gmail.com 

Cloned

$ git clone https://UserName@code.google.com/p/repository/

Then I made changes to files / added new files etc. and added

$ git add .

Committed

$ git commit -m "Message"

Pulled to make sure I am up to date

$ git pull
Already up-to-date.

But when I push I am not prompted for password

$ git push origin master
fatal: remote error: Invalid username/password.
You may need to use your generated googlecode.com password; see https://code.goo
gle.com/hosting/settings

Any suggestions? Thanks.

0xBrandon
  • 1,739
  • 3
  • 18
  • 21

4 Answers4

15

For similar issues NOT specific to machine.google.com, you can try removing or updating the saved git password in windows credential manager. My system had my old password saved:

  1. Start
  2. Type: Credential Manager
  3. Double-Click the Windows Credential Manager shortcut
  4. Click on the "Windows Credentials" tab.
  5. Locate the credentials that you want removed, they will start with "git:" and might begin with "ada:"
  6. Click on the credential entry, it will open a details view of the entry.
  7. Click Remove to remove, or Edit to Update the password

credit: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/141

tb.
  • 723
  • 7
  • 16
  • This helped. I was able to find the github credentials under windows credential manager. I removed the one with "Persistence: Local Computer" and that worked. Later GitBash prompted for the username and password. Thanks. – aashima Dec 14 '21 at 06:42
4

Edit: Looks like you can't access google code successfully by putting the username in the URL (at least as of August 2011), see this: netrc not accepted by git


That said, this might work:

Taken from the URL shown above (you have to visit the site):

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 blah.blah@gmail.com password mypasswordXXX123

Once you have the above item, it looks like in Git Bash you should be able to update your _netrc file like this:

echo "machine code.google.com login blah.blah@gmail.com password mypasswordXXX123" > $HOME/_netrc

Community
  • 1
  • 1
Adam Rofer
  • 6,121
  • 1
  • 14
  • 11
  • I am under the impression that because I am using a user name in the clone command that I should be prompted for a password, and should not need a _netrc file. – 0xBrandon Feb 08 '12 at 02:12
  • It looks like this sort of thing has been an issue before: http://groups.google.com/group/google-code-hosting/browse_thread/thread/21391bc402e94c79?pli=1 - and there's more information here - http://code.google.com/p/support/wiki/GitFAQ - but none for this particular issue... – Adam Rofer Feb 08 '12 at 02:36
  • 2
    having the same issue on linux with google code. git clone works but commit suddently doesn't. removing the username from the .git/config forced git to reask for username and password. thanks! it works now – ufk Feb 26 '12 at 16:37
2

The comment by ufk is the correct answer. To be more explicit, if you push with

git push https://code.google.com/p/name-of-project/ master

you will be prompted for username and password (assuming .netrc is not set as specified by OP). Instead of master you could specify another branch, but omitting the branch probably won't work.

Andrew Youdin
  • 83
  • 1
  • 1
  • 6
0

Put the following command in git bash

git config --global core.askpass /usr/libexec/git-core/git-gui--askpass

Sathish M
  • 345
  • 2
  • 6