15

We recently moved our github from one account owner to another, and now all of the sudden when I do a git pull or any git command on the remote repo, it asks me for github username and password.

My git-config says:

[github] user = kamilski81 token = ********* 

Any idea how I can stop it asking me for credentials and remember everything, does the new owner have to setup my ssh keys or something of that sort?

4 Answers 4

24

Following this article sorted it out for me: https://help.github.com/articles/why-is-git-always-asking-for-my-password

git remote set-url origin [email protected]:user/repo.git 
Sign up to request clarification or add additional context in comments.

1 Comment

Basically, this is the shortest answer :)
15

The github username and token in the gitconfig is only used for interactions with the GitHub API (for instance the hub gem and the github tool).

If you are pushing and pulling from a GitHub repository over https, then you need to specify your credentials every time, or hook into a password manager to remember the credentials for you. How to do this depends on your platform.

The easiest thing to do is to go to your github account and submit your SSH public key to your account, and then switch your github remote to push/pull over ssh instead of https.

[edit] After re-reading the question I noticed that you mentioned it was previously a GitHub repo that was just moved from one owner to another. If that's the case, and you ARE able to push and pull by specifying your credentials, it sounds to me to be one of two scenarios:

  • The previous remote used ssh, and GitHub has your SSH key; but when the owner changed and you updated the remote, you updated it to go over https.
  • The previous remote used https, but you had a password manager setup correctly to deal with your credentials, which no longer works.

1 Comment

Thanks Alex, The remote that was previously working was https, and the new remote is also https. I am running on a Mac, which password manager should I look into?
12

After doing git remote -v, the issue was that my remote was using an "https" remote rather than "git" remote. Changing the remote to use git rather than https solved everything.

Comments

0

If you execute only once git pull and Git client still asking you the credential without do the git pull for you, the problem should be because your credential is incorrect or not setup yet.

but if you get the dialog ask for credential one for each operation, it mean that your credential isn't remembered. To do that, you may use Pageant to store your SSH private key, so, everytime you do something, it will retrieve your credential from Pageant instead to asking you.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.