Pushing to new GitHub organisations gets 403 error
Asked Answered
D

3

13

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?

Description answered 27/2, 2019 at 12:34 Comment(8)
can you check git remote -v has listed your expected repository ?Anoint
Yes, it exactly matches the https://github.com/[org]/[repo].git value given in the Clone with HTTPS panel.Description
Noticed that the git push didn't ask for the username & password, this leds me to a question I recently seen, who is also using OS X, that is receiving 401 and found nowhere to modify his GitHub token. At the end he found it is located in the password keyring (something similar, I don't have an OS X), and solved by editing it. I am not sure if this can help you, if you have 2 accounts and mixed them, for example.Habitat
Thanks for that suggestion Geno. No, I just have one GitHub account, and I can push to repos in other organisations from the CLI. It may be OSX Keychain related in some way, though I don't know why it's ok with legacy organisations & not new ones.Description
Have you tried deleting the github.com entries from your keychain? Applications -> Utilties -> Keychain Access and search for github.com and delete. Then retry to see if it makes difference. Worst case - you will just add them again and nothing will be lost.Curculio
Thanks for the +hovanessyan . I've just tested it from a MS Windows VM - so it does look like it's at the GitHub end.Description
Just an idea: Try using command line in Terminal, clone using ssh instead of https, tweak, push, all at the command line, see if that works.Transience
Also please read thru all of #5335697 as there might be something applicable.Transience
D
9

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.

Description answered 2/3, 2019 at 14:27 Comment(0)
B
3

I had the same issue with SourceTree.

HTTP Error Code 403 and no access, but using GitHub.com (web) worked without any issues. As pointed out already, the third party application has no access.

Ensure that your Organization has the third-party app approved (SourceTree, GitKraken, etc.) https://github.com/organizations/%ORGANIZATION_NAME%/settings/oauth_application_policy

Third-party access on organization

  • You can approve the app by first connecting it with your account and then going to https://github.com/settings/connections/applications/
  • From there, click on the name (link) and the application detailsv will be shown. -At the bottom, you'll see your Organizations and you can approve it ❤️
Berryman answered 19/7, 2022 at 9:42 Comment(0)
O
-1

Basically it's better to make a pull request instead of pushing code to organization.

If you wants to push little bit of code or tags without caring about ssh or token, you can use GitKraken (only works one of my 2 PCs) or Github desktop (It's no reason it cannot work)

Ornament answered 26/7, 2020 at 9:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.