1

I'm trying a 'git push'

I'm very new to Github and have managed to run git clone and get the directory onto my Mac and I've made changes to a readme file (to test things) and then ran a

git commit -a -m "Changes to readme file"
git push

But get this message:

ERROR: Write access to repository not granted. fatal: Could not read from remote repository.

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

I've Googled this error and tried a few of the suggestions with no success. If I run this it looks ok: ssh -T git@github.com

I get:

Hi joebloggs! You've successfully authenticated, but GitHub does not provide shell access.

Any ideas what I'm doing wrong here? Thanks

Gonzo
  • 11
  • 5

1 Answers1

0

Check first if you are actually using an SSH URL

cd /path/to/repo
git remote -v

If it starts with HTTPS, then your SSH key would be irrelevant.

Second, make sure you have cloned a repository you have created, under your GitHub user account.
Cloning a public repository you have not created is possible (since it is "public"), but that does not give you the right to push back to it. For that, you would need to fork the repository first, before cloning it.
See also "Are Git forks actually Git clones?".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I did use my GitHub user account on this repo yes. That command results in: origin git@github.com:our-infrastructure/our.git (fetch) origin git@github.com:our-infrastructure/our.git (push) – Gonzo Mar 31 '23 at 12:43
  • @AndyWhite Are you the owner of `our-infrastructure`? – VonC Mar 31 '23 at 12:45
  • @AndyWhite See also [this question](https://stackoverflow.com/q/52936638/6309). – VonC Mar 31 '23 at 12:46
  • I didn't create it, it's part of a huge AWS environment our org runs, I'm trying to update just an area someone created for his project. – Gonzo Mar 31 '23 at 13:27
  • @AndyWhite So you need the admin of that organization to add your GitHub user account to the list of members. – VonC Mar 31 '23 at 14:23