Quantcast
Viewing all articles
Browse latest Browse all 1535

Trying pushing to remote repository, permission denied and received error 403

I created a local repository on my laptop (MacOS) and started a project. After working on it for some time I wanted to sync it with an empty remote repository I made on GitHub. I tried to link the repositories using HTTPS and GitHub access tokens. First I added and set up the remote like this in Shell:

$ git remote add origin https://github.com/[username]/[github-repository-name].git

Then I generated a fine-grained access token and entered it in a command like this:

$ git remote set-url origin https://[github-token]@github.com/[username]/[github-repository-name].git

But when I tried pushing my local changes, I received an error in this format:

remote: Permission to [username]/[github-repository-name].git denied to [username]

fatal: unable to access 'https://github.com/[username]/[github-repository-name].git/': The requested URL returned error: 403

I checked that my remote repository had public access, tried created another fine-grained access token and made sure to click "Public Repositories (read-only)" under "Repository access" and repeating the steps I made in the beginning and double-checked that the remote url was correct. However I received the same output again.

I tried google searching my problem but after some time, I'm still stuck. I know I can try using SSH instead but I want to figure out what went wrong so I know how to avoid it in the future. I'm new to using GitHub so I appreciate any explanation or tips on solving this problem.


Viewing all articles
Browse latest Browse all 1535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>