Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remote: Write access to repository not granted. - admin of repo but within an organisation

Tags:

github

  1. I'm part of an organization, and through the UI I can create a private repository inside that organization.

  2. Going on repository -> setting -> Collaboration and team, I can see I'm the admin

  3. I've created my PAT and in fact, I can commit and push other public repositories.

  4. But if I clone this new repository I get "fatal: unable to access"

Is there anything specific to do when creating repos inside an organization?

If I try to create a new PAT and try to create it for specific repos, I can't see this new repo in the list of my repos! So I have to create it for "All repositories".

Other trials:

  • git clone https://<username>:<token>@github.com/orgName/repoName failed
  • git clone https://<username>@github.com/orgName/repoName failed
  • git clone https://github.com/orgName/repoName of course failed as well

BUT, one strange thing: git clone https://<token>@github.com/orgName/repoName asked me for a password

I didn't go on, maybe it's recognized just as a new username so it was asking for a password

like image 556
T. Rossi Avatar asked Oct 17 '25 15:10

T. Rossi


1 Answers

I was facing the same issue but it turned out the problem for me was the local storage of credentials. It is possible to access an organisation repo over HTTPS using a fine-grained personal access token (PAT). Here are a few things to watch out for:

  1. Make sure your organisation is opted-in to fine-grained personal access tokens as per this discussion
  2. Create a new fine-grained PAT with the organisation as the resource owner and the repo(s) of interest included. That key should at least have access to Contents in the repository permissions.
  3. Lodge your credentials locally. I struggled with this, and in the end just deleted ~/.git-credentials and then on git clone I was prompted to enter my username and the new key. There's probably a better way (but looks like others struggle with unset...)
like image 195
Tom Wagstaff Avatar answered Oct 21 '25 09:10

Tom Wagstaff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!