I am trying for the first time to use git and GitHub to version control my project.
Here is what i have done
However, the git push
command is giving me the following error
remote: Permission to VENDORNAME/PROJECT-NAME.git denied to malhayek2014. fatal: unable to access 'https://github.com/VENDORNAME/PROJECT-NAME.git/': The requested URL returned error: 403
Here are the commands I ecexuted before running into the errors
echo "A message for the read me file" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/VENDOR-NAME/PROJECT-NAME.git
git push -u origin master
How can I communicate with Github and push code to it?
When you want to use SSH for pushing and pulling you have to use the ssh URL (which looks like git@github.com:username/project.git
) and not the https URL.
In order to update an existing repository you can issue the following command:
git remote set-url origin git@github.com:VENDOR-NAME/PROJECT-NAME.git
See https://help.github.com/articles/changing-a-remote-s-url/
PS: The error message you provide indicates that you are successfully authenticated using https, however, you don't have persissions to push to that repository - that's independent to the SSH problem. You need to add yourself to the team if you are one of the owners or ask the owners to do so - or add your SSH key as a deployment key.