2

I recently made a new GitHub account. With this new GitHub account, I've created a new repository. After cloning the repository to my local PC, I staged and committed some files. When I attempt to push to this repository, it state's that I don't have permission to push to the repository. It appears that Git Bash is using my old GitHub account information, seeing as how the return message is:

$ git push
remote: Permission to newusername/project.git denied to oldusername.
fatal: unable to access 'https://github.com/newusername/project.git/': The requested URL returned error: 403

So this seems straight forward that all I would need to do is change my account information in which Git Bash is referencing. I made changes to the 'config' data by providing my new username and email. I even verified that I didn't have environmental variables (such as GIT_COMMITTER_NAME or GIT_AUTHOR_NAME) overriding user name.

However, when I go back to push to the remote repository, it still returns an error message stating that I don't have permission to upload changes.

I even went as far as uninstalling Git in hopes that it would forget my old login information, but it seems to have remembered the data. I'm just looking for a prompt where I can enter my GitHub username and password.

Any help?

Izzo
  • 4,461
  • 13
  • 45
  • 82
  • Are you using an SSH key for auth? – kylieCatt Sep 02 '16 at 01:28
  • @IanAuld I'm relatively new to Git, so I'm not sure. I had also set up my original Git information over a year ago, so I can't remember if I had enabled anything like this. All I can remember is that I used to 'git push' and it would prompt me for my GitHub information before allowing me to upload the changes.. – Izzo Sep 02 '16 at 01:29
  • Use credential helper and just reset it with your new username and password. Read [here](http://stackoverflow.com/questions/11403407/git-asks-for-username-everytime-i-push) for more information. – Tim Biegeleisen Sep 02 '16 at 01:32
  • @TimBiegeleisen I just followed the commands listed in your posted solution. Git doesn't seem to recognize them as valid commands. I do need to enable something before I'm able to access the 'credential' commands? – Izzo Sep 02 '16 at 01:35
  • Are you on Windows, and did you launch the Bash in admin mode? – Tim Biegeleisen Sep 02 '16 at 01:37
  • @TimBiegeleisen Yes I am on Windows and I did launch Git Bash as admin. When I post the "$ git config credential.helper store" nothing happens. I then post "$ git push http://example.com/repo.git" and it states that 'oldusername' doesn't have permission. – Izzo Sep 02 '16 at 01:40
  • You aren't actually typing those dollar signs, are you? – Tim Biegeleisen Sep 02 '16 at 01:42
  • @TimBiegeleisen Correct. I assume I have my old username stored as a credential. Is there a command for listing the currently stored username? – Izzo Sep 02 '16 at 01:49
  • So are you typing `$` yes or no? The command should work. What version of Git are you using? – Tim Biegeleisen Sep 02 '16 at 01:51
  • @TimBiegeleisen I am not using the $. The command returns nothing when I enter it. I am using Git Bash with Git version 2.9.3.2 – Izzo Sep 02 '16 at 01:53
  • `When I attempt to push to this repository, it state's that I don't have permission to push to the repository` ... your old username does not have push rights, hence you won't be able to configure the credential helper. Did you upload your SSH cert to GitHub for that old user? To be clear, the behavior you are getting from credential helper is totally expected given that you cannot even push to GitHub. – Tim Biegeleisen Sep 02 '16 at 02:09
  • @TimBiegeleisen Hi Tim, I appreciate the help so far. So I did in fact generate an SSH key for my old username and I uploaded it to GitHub. I just logged into my old GitHub account and deleted the key. I then generated a new SSH key following the guide here (https://help.github.com/articles/generating-an-ssh-key/). I deleted all keys on my PC before doing so. After generating the keys, I loaded the private key through Bash, I then added the public key to my new GitHub user account. I was hoping this would fix the problem. However, I'm still get a 'permission denied' associated with my old name – Izzo Sep 02 '16 at 02:38
  • I'm not sure what you did, but once you get access to GitHub, everything else should start working. – Tim Biegeleisen Sep 02 '16 at 02:48
  • Also see http://stackoverflow.com/a/39944557/3906760 for how to reset a stored password for https transports – MrTux Oct 09 '16 at 14:30

0 Answers0