Owner can't push to organization repository
Asked Answered
L

8

11

today I've moved my private github repository to newly created organization (of which I'm an owner). I've changed my remote origin to [email protected]:organization/repo.git. I'm not able to push to remote because I've got an error saying

Error: Permission to organization/repo.git denied to MyGithubUsername.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

I've checked that my account is owner of organization and repository exists.

Livingstone answered 22/10, 2018 at 19:38 Comment(4)
Are you sure that the organization and repo were successfully created? GitHub has had major service issues over the last ~20 hours.Shulins
Everything looks ok. github.com/MealkyTeam/MealkyLivingstone
Are you sure that the moved repo is still aware of your ssh key?Page
My key id_rsa.pub was already added to my github account. I've added it again but problem persist.Livingstone
L
1

I managed to find an answer. Maybe I did something wrong, or maybe it was because of github issues, but even if I was stated as an owner of Organization I had only rights to read repository. I couldn't change permission for myself because "you can't change permission for owner". I changed permissions for all members to admin, and because for now I'm the only one member of organization it's not a big deal.

Livingstone answered 25/10, 2018 at 7:6 Comment(0)
H
11

Disable third-party application access restrictions as suggested in atom/github #1010.422882361.

Humiliate answered 17/1, 2020 at 21:43 Comment(1)
This is crazy, but it fixes it for me. I double checked my ssh keys, even made new ones, nothing worked. I am the organisation owner, other members had no issues. I had no issues with my personal repos. Seems like a bug in github. The fix was as shown here, go to organisation settings, scroll down to 3rd party access, choose oauth application policy, then disable restrictions...Comprehensive
G
4

I ran into this problem today and indeed as Ephellon Dantzler suggests, disabling 3rd-party access restrictions fixed it.

However, I did not really like that solution so I started reading the documentation. On the About OAuth App access reistrictions page, Github mentions that enabling 3rd party restrictions will block:

SSH keys created before February 2014 immediately lose access to the organization's resources (this includes user and deploy keys).

I created my key well before that so I just created a new SSH key and added to Github following their instructions.

After that, I was able to interface with my organization's private repository even when 3rd-party access restrictions was enabled.

Georgettageorgette answered 14/9, 2020 at 16:28 Comment(3)
there's no need to disable 3rd-Party access restrictions. Apparently the problem is with the ssh encryption, so generating a new key pair (hopefully with ed25519) an uploading it to github solves the problem.Example
@GabrielCabrera Right -- as my post states, this is probably a case of your key being too old.Georgettageorgette
this didn't work for me. I'm still getting the error repository not found. Although, using a Personal Access token did work.Hammel
L
1

I managed to find an answer. Maybe I did something wrong, or maybe it was because of github issues, but even if I was stated as an owner of Organization I had only rights to read repository. I couldn't change permission for myself because "you can't change permission for owner". I changed permissions for all members to admin, and because for now I'm the only one member of organization it's not a big deal.

Livingstone answered 25/10, 2018 at 7:6 Comment(0)
U
1

The solution I found to this problem was creating a P.A.T (Personal Access Token) and using it in the spot of my password when pushing to the repo.

The way you can create a P.A.T is by going to:

Github.com >Login> Settings> Developer Settings> Personal Access Tokens > Generate New Token. I selected all the options for my token and then copied the token that was generated and used it as my password when I was asked to enter my credentials.

This took me a few hours to figure out and was very frustrating. I hope this info can help someone else!

Unloose answered 26/8, 2021 at 23:16 Comment(0)
P
1

I could not push commits from GoLand/IntelliJ to my GitHub organization repo.

The solution that worked for me is

  1. Go to https://github.com/organizations/<orgname>/settings/oauth_application_policy

  2. Set policy Policy: No restrictions

Primer answered 3/12, 2023 at 4:14 Comment(0)
S
0

Using GitHub Desktop..I was having a weird bug where I was owner of the organization, and admin of the repo(I had full rights) on my organization's repo. I decided to go into the command line, and push from there (Type "git push") and that fixed it! It pushed, and I could now push from GitHub Desktop again. Weird, but hope it helps someone!

Subglacial answered 22/1, 2019 at 3:32 Comment(0)
T
0

For me, everything was ok in the Settings and with my key. Yet Github Desktop could not push (or even fetch) to/from the remote because it didn't trust the IP address. To find and fix I switched to the CLI and ran:

git fetch

which replied with

The authenticity of host 'github.com (140.82.114.4)' can't be established.
RSA key fingerprint is SHA256:<long string>.
Are you sure you want to continue connecting (yes/no)? 

therefore revealing the issue. Either Github has changed their IP or I hadn't connected to this repo on my new machine (with the old key). Replying yes added the IP to my .ssh/known_hosts and then Github Desktop worked just fine again.

Warning: Permanently added 'github.com,140.82.114.4' (RSA) to the list of known hosts.
Taxiplane answered 24/11, 2020 at 18:28 Comment(0)
P
0

So I ran into this issue recently with an SSH key generated in 2018 and Ephellon Grey's answer pointed me in the right direction. My personal SSH key was added to GitHub by SourceTree and SourceTree was not an authorized third-party app on my organization page. Hence pushes authorized with that SSH key were being rejected. I just had to grant third-party access to SourceTree on the organization and now I can push to repos contained within.

Pekin answered 30/4, 2021 at 22:7 Comment(1)
How did you grant third-party access to SourceTree on the organization? In my case, I can see "SourcetreeForMac" is an authorized OAuth app in my personal account but I can't see any means of adding it to my organization account.Mousetrap

© 2022 - 2024 — McMap. All rights reserved.