Title:
Git push returning 403 permission denied when pushing to GitHub repository
Description:
I am trying to push a local Git repository to GitHub from my macOS terminal. When I run the push command, Git asks for authentication and then returns a permission error.
The command I run:
git push origin main
After entering authentication details, I receive the following error:
remote: Permission to repository denied.
fatal: unable to access 'https://github.com/.../git-learning.git/': The requested URL returned error: 403
Environment
macOS (MacBook Air)
Git installed locally
Repository already created on GitHub
Things I have already tried
Verified that the repository exists on GitHub
Checked the remote URL using:
git remote -v
Generated a Personal Access Token and used it for authentication
Tried pushing again using:
git push -u origin main
However, the same 403 permission denied error keeps appearing.
Question
What could be causing this 403 permission denied error when pushing to a GitHub repository, and how can I fix it?