I have a new system (MacBook Pro) and want to set it up such that it can directly push to my remote repository on GitHub. The steps I followed were:
- Generated an ssh key using the command
ssh-keygen -t rsa
. - Copied the content from
id_rsa.pub
into the SSH key area of my Github account. - Created a repository on GitHub.
- Copied the repository url (https) into my existing local project using
git remote set-url origin https://github.com/username/repo.git
. - Took a pull using
git pull origin master
(which worked without errors). - While pushing the new changes using
git push origin master
I got the below error.
remote: Permission to UserName/repo-name.git denied to name.
fatal: unable to access 'https://github.com/UserName/repo-name.git/': The requested URL returned error: 403
Question:
1. Why am I getting the permissions denied error even after adding the SSH key to Github? Shouldn't GitHub consider my system to be trusted device after adding an SSH key?
2. How do I add my system as a trusted device so that I don't get the permissions denied error?