1

I am trying to upload a project to github so I ran the command

$ git push origin master

but it gives me

remmote: Permission to [repo name] denied to [old github account I used on this 
laptop]

fatal: unable to access repository
ckaepie
  • 13
  • 5

1 Answers1

1

You need first to check the remote URL used:

git remote -v

If it starts with https://, you might have a cache with the wrong credentials in it

git config credential.helper

For instance, see "sign out in the Git Bash console in Windows":

git credential-manager reject https://github.com

On Mac, for osxkeychain, see "Updating credentials from the OSX Keychain"

git credential-osxkeychain erase https://github.com

Then the next push would trigger a popup asking you to enter the username/password.


If it starts with git@github.com:..., you might use the default id_rsa private key for the old account.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • DO I type $git remote -v? – ckaepie Mar 15 '20 at 02:20
  • 1
    @ckaepie no need for the $ (prompt sign): just `git remote -v` in the folder where your repository is (where you typed `git push` before) – VonC Mar 15 '20 at 02:23
  • It is giving me this: fatal: not a git repository (or any of the parent directories): .git – ckaepie Mar 15 '20 at 02:25
  • 1
    If you were able to type `git push` before, you should type it in the same spot. It should be in the root folder of your local repository, where you can see a `.git/` subfolder. – VonC Mar 15 '20 at 02:27
  • ok I see it thank you for the next command do I enter my old account girhub url or do I just write https://github.com – ckaepie Mar 15 '20 at 02:48
  • When I try to do git credential-manager reject it gives me this: fatal: InvalidOperationException encountered. Invalid input, please see 'https://www.kernel.org/pub/software/scm/git/docs/git-credential.html'. – ckaepie Mar 15 '20 at 03:00
  • 1
    @ckaepie It depends on the result of `git config credential.helper` – VonC Mar 15 '20 at 03:01
  • 1
    @ckaepie I have to go, but I'll check in in a few hours. Leave the output of `git config credential.helper` as well as `git version` and your OS. – VonC Mar 15 '20 at 03:07
  • It says MANAGER. OS: Windows 10. Git Version: 2.25.0.windows.1 – ckaepie Mar 15 '20 at 03:12
  • 1
    Then the reject should work, with https://github.com at the end. – VonC Mar 15 '20 at 03:26
  • It must be another problem because I went in my control panel -> credentials and my github credential was correct to my current account. Must be another problem :/ – ckaepie Mar 15 '20 at 03:52
  • Then what is the remote url you are working with? What is the output of git remote -v? – VonC Mar 15 '20 at 10:34