fatal: unable to access 'https://github.com/usename/my-project.git/': The requested URL returned error: 403 Mac

Viewed 5556

I trying to push an existing repository from the command line, i followed the git hub steps below, it looks like github change master to main.

…or push an existing repository from the command line git remote add origin git@github.com:username/my-project.git git branch -M main git push -u origin main

I read the solutions for window user to solve the error 403 ;

I am using Mac notebook, i don't have a control panel on my system, i don't see the credential management either. My ssh key is successful connected to github.

1 Answers

403 means Forbidden, which means that you've authenticated but lack the permissions to perform that action. This could be for several reasons:

  • Your credentials are correct, but you don't have the ability to push to that repository, in which case you need to ask for permissions.
  • You're using a password but you have 2FA set up and need to use a personal access token instead.
  • Your credentials are for a different account, which means that you don't have access to that repository.

Note that you're using HTTPS here. If you want to use SSH, then you need to use an SSH URL by changing the remote like so: git remote set-url origin git@github.com:usename/my-project.git.

If you want to reset your HTTPS credentials, the Git FAQ explains how to do that.

Related