9

Weeks ago (and in a fog), I needed to make some changes to something hosted at github. I was directed by someone-who-knows-more-than-me (SWKMTM) via phone on exactly what to type in order to configure, pull down, modify, push back and then activate things. Part of this involved issuing instructions to git that said I as SWKMTM.

Now that I've had time to learn a bit about git/github (as well as to recall my github login information), I've gone back and tried to substitute my identity for SWKMTM on my client machine (a la git config --global user.name and git config --global user.email). After doing this, I can perform the same update activities as before. However, I have yet to be prompted to enter my github password (i.e., there is NO request to enter my github password). I'm assuming that something has been cached identifying me as SWKMTM (and that I must've done something in the earlier fog that involved entering SWKMTM's github password) -- either locally or by implicitly sending my SSH public key.

I've searched around in vain for .*rc files and configuration directories for anything that resembles credentials that might be associated with SWKMTM (in hopes of dispatching said credentials and forcing git to prompt for new ones). I've similarly failed to find anything at github that might tell if there is some sort of aliasing for public keys (and how it might be purged).

I've also tried the advised "git config -l" for any credential helper and have found none.

How can I force github to forget that I've been masquerading as SWKMTM?

[sidenote: this is on MacOS with no indication in config files that credential-osxkeychain is used. Only after using GIT_TRACE=1 on a push was it obvious where the credentialing was stored.]

Community
  • 1
  • 1
jhfrontz
  • 1,165
  • 4
  • 19
  • 31
  • I am a bit lost with your question. Are you using with ssh or https to connect to github? – Pigueiras Sep 22 '13 at 19:42
  • You can find out what url you're using by looking at /.git/config . Most likely it's https see: https://help.github.com/articles/why-is-git-always-asking-for-my-password – Kerry Liu Sep 22 '13 at 19:44
  • @Pigueiras I'm assuming that since there is a line in the config that reads "url = https://github.com..." that I'm using https? Truly, I have no recollection of doing anything explicit to set this up (and am only able to recall things by looking at my CLI history). – jhfrontz Sep 22 '13 at 19:49
  • Also, @Pigueiras your edit is wrong -- I do NOT get prompted to enter my password. – jhfrontz Sep 22 '13 at 19:53
  • Sorry, I thought you meant that. I rolled back. So you are trying to say *I don't get prompted yet*? – Pigueiras Sep 22 '13 at 19:57
  • Try to set a new ssh origin to the repo with `git remote set-url origin git://new.url.here` – Pigueiras Sep 22 '13 at 19:59
  • @Pigueiras Yes, exactly. I was expecting to get prompted to enter new credentials when I (thought I) changed my identity. But knittl is saying that I haven't actually changed my credentials? – jhfrontz Sep 22 '13 at 19:59
  • 1
    No, you did not change any credentials. Why do you expect you get prompted for a new password when you change `user.name` and `user.email` config options? They are simply strings used in your commit objects. – knittl Sep 22 '13 at 20:00
  • @knittl: because they were the only things that I can see in my command history that had anything that I would have thought of as "credentials". Nothing else had anything that seemed to be associated with the github username. – jhfrontz Sep 22 '13 at 20:03
  • I've had weird problems with git failing to prompt for credentials if I'm running `git clone` or similar commands this way: `su [username] -c "git clone [...]"`. `sudo -u [username] git clone [...]` works fine, though. – sudo Jan 04 '17 at 20:23

1 Answers1

6

user.name and user.email have nothing to do with credentials, they are just strings that are put into each commit you make to store your authorship information.

Git normally authenticates you via SSH, so you have to either copy your SSH private key from the other machine to your new client, or create a new key pair and add the public part to your github profile.


OK, after extensive discussion in the chat it turns out that Git was using the osxkeychain credential helper which provided previously stored credentials.

Remove your stored credentials from your OSX keychain or disable the crendential helper (credential.helper config option) in Git to be prompted for authentication again.

knittl
  • 246,190
  • 53
  • 318
  • 364
  • I'm on the same client; it's my identity that I'm trying to change. I don't recall having done anything in the past to create key pairs on my github profile. – jhfrontz Sep 22 '13 at 19:51
  • @jhfrontz: hmm… github identifies you via your push url … it should be something like `ssh://user@github.com:user/project.git`. Or do you mean something different with "changing your identity"? – knittl Sep 22 '13 at 19:55
  • not sure what the "push url" is. The `push` command I use has just "origin" and "master". – jhfrontz Sep 22 '13 at 19:58
  • How did you clone your git repository? Cloning a repository sets up a default remote named `origin` with the url you cloned from. – knittl Sep 22 '13 at 19:59
  • Looking through my history, I see a command like `git clone https://github.com...` – jhfrontz Sep 22 '13 at 20:01
  • I'm still not sure I understand your original question. What is your problem? Can you push to your remote repository? Or does it fail when you try to push? Have you made a new clone and try to push from that and it fails? Are you trying to push from a different machine? – knittl Sep 22 '13 at 20:02
  • From what I'm gathering after reading all the comments, I think my question is more properly worded as "How do I force git to forget that I've been credentialed?" – jhfrontz Sep 22 '13 at 20:05
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/37838/discussion-between-jhfrontz-and-knittl) – jhfrontz Sep 22 '13 at 20:26