Create a new repo on the command line

I recently watched the “Starting a Code Base in GitHub” video and I am stuck pushing the repo from my machine to the existing repo on GitHub.

I created a repo on GitHub and followed the steps below:

echo “# code_practice” >>
git init
git add
git commit -m “first commit”
git branch -M main
git remote add origin
git push -u origin main

When I go to complete the last step I get the following error:

git push -u origin main
remote: Write access to repository not granted.
fatal: unable to access ‘’: The requested URL returned error: 403

What did I do wrong and what is the fix?


Did you authenticate via SSH? Connecting to GitHub with SSH - GitHub Docs

1 Like

Do I still need to authenticate via SSH if I’m using HTTPS?

Try the documentation here: About remote repositories - GitHub Docs

HTTPS is fine as well.