Search code examples
gitgit-pushpermission-denied

Why am I suddenly not having push permission?


I use

git remote set-url origin https://[email protected]/QuaCau-TheSphere/LandofSpheres.git

But why can't I push?

git push
remote: Permission to QuaCau-TheSphere/LandofSpheres.git denied to ooker777.
fatal: unable to access 'https://github.com/QuaCau-TheSphere/LandofSpheres.git/': The requested URL returned error: 403

I am the creator of the organization and the admin of the repo so I must have permission. I pushed successfully before, so it shouldn't be SSH stuff. I don't understand why it happens today.


Solution

  • To avoid opening GitHub Desktop and signing in again, check your credential helper

    git config --global credential.helper
    

    Then, assuming for instance, manager-core, check what is registered for your user:

    printf "host=github.com\nprotocol=https\nusername=ooker777" | git credential-manager-core get
    

    If you don't see anything, register your PAT (Personal Access Token) (assuming one which does not expire)

    printf "host=github.com\nprotocol=https\nusername=ooker777\npassword=ghp_yourToken" | git credential-manager-core store
    

    That way, you won't have to sign in again.