Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing to new GitHub organisations gets 403 error

I've encountered a recent problem, it applies to any new GitHub organisations I create.

I am admin for two fairly mature GitHub organisations. I can create repos within them, and everything "just works". (SmartGit, & CLI Git, OSX).

But, if I create a new organisation, I can't Push to it, I get a 403 error:

$ git push 
remote: Permission to [org]/[repo].git denied to [username].
fatal: unable to access 'https://github.com/[org]/[repo].git/': 
  The requested URL returned error: 403
$

Steps to reproduce:

  1. create organisation
  2. create repo within organisation
  3. make text edit via GitHub
  4. clone repo
  5. make text change
  6. add/commit/push > 403 error reported

I can make (& commit) changes via the GitHub.com web-page interface, but I can't push them from my local repo.

Note: From a different PC I can push to repos in existing organisations, but not the new ones. The other PC was still a Mac though, so it may be keychain related. Ok, I've tested it from a Windows VM, and it still fails. So, it does look like something at the GitHub end.

Any suggestions?

like image 241
ianmayo Avatar asked Feb 27 '19 12:02

ianmayo


People also ask

How do I fix the requested URL returned error 403 in Git repository?

The first is relatively simple to resolve and simply involves checking to ensure your GitHub password is correct. If the error persists, it is likely that you have to use a different HTTPS address in your Git client. For this error, you will not even be prompted to enter a password, making it simpler to diagnose.

What is the meaning of HTTP status code 403?

The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it. This status is similar to 401 , but for the 403 Forbidden status code re-authenticating makes no difference.

How do I trigger a 403 error?

The most common cause of a 403 Forbidden Error is simply inputting an incorrect URL. As discussed before, many tightly secured web servers disallow access to improper URLs. This could be anything from accessing a file directory to accessing a private page meant for other users.


1 Answers

I installed GitKraken in a VM 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.

like image 197
ianmayo Avatar answered Sep 19 '22 13:09

ianmayo