403 error when pushing to Repos in new Organisations

I have two organisations, and can create repos within them, and push to these repos.

For any new organisations I create, I can make edits via GitHub.com, but when I try to push local changes I get:

remote: Permission to [new-org]/[new-repo].git denied to [user-name].
fatal: unable to access ‘https://github.com/[new-org]/[new-repo].git/’: The requested URL returned error: 403

I get the above issue if I try to push from command line or from SmartGit.

Pushing to repos from my existing organisations works fine in both cases.

Did you try doing this on different networks? Are you using the correct account locally?

Aah, good suggestion.  I different network may be a challenge, but I can certainly try it from a different PC.

1 Like

Ok, from a different PC I get the same 403 denied error when I push to a repo under the new organisations.  But, I can push changes from the older organisations.

1 Like

Ok. I’ve just run a test from a MS Windows VM, and get the same problem.  Can push to repos from old orgs, but not the new ones.

1 Like

Ok, I was running a further trial, on a Linux VM.

I installed GitKraken, and in the GitHub authorisation process I had to indicate when organisations it could access.

The new repo had a red Cross against it. I selected it, to allow GitKraken access to that organisation. GitKraken was then able to push to the new repo.

I then received an email telling me the GitHub authorisation had been added. It included a link to this page https://github.com/settings/connections/applications/

From that page I was able to view authorised OAuth apps. SmartGit (my normal Git client was listed). When I went into the page for that app, I saw it wasn’t allowed access to my new organisation. I authorised access.

From that point on, I was able to push from either SmartGit or the command-line.

Fixed!

8 Likes

Wow, that is some nice investigation! Glad you got it fixed!

1 Like

Step 1: Add your PC/Mac’s SSH key to your Github Account
Refer - https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account
Step2: Clone with SSH instead of HTTPS