Issues pushing repository to Github

Hi Everyone,

I have tried what seems like everything to commit my repository to github but it isn’t connecting my data to github for some reason. I am getting the below error when I try to push it to github, I’ve attached a screenshot for reference.

I’m not sure if this makes a difference but I tried using the steps that mosh provided in his tutorial in CSS part 3 lesson 43 but nothing seems to work. I watched a youtube tutorial that showed me how to create a new branch in VS Code which I tried but I didn’t understand the purpose for it, the reason I mention this is because I’m also not sure whether adding the new branch is causing me issues pushing my repo to github.

Below I’ve included another error that I’ve been receiving.

bethany@Bethanys-MacBook-Pro Moshify % git remote add origin bsolomon18/moshifyclone · GitHub
git branch -M main
git push -u origin main
fatal: remote origin already exists.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
bethany@Bethanys-MacBook-Pro Moshify %

1 Like

Actually I think I may have figured out the issue, if someone could double check for me that I did things properly I would be so appreciative. Here’s my github url with my project GitHub - bsolomon18/moshifyclone

The issue in my case was that I did not have an SSH key setup on my machine, this isn’t discussed in the course but I used chatGPT to help me figure out why I couldn’t commit my changes to github. The repo that I initially tried to commit was also empty, when I switched over to the main branch from the master (default) branch that VS Code created for me I don’t think my files merged. I verified that my files were in the master branch, looked at the files in the main branch, and merged the two then created my SSH key on VS Code, linked it to my github account, and then pushed my repo to github.

Yeah i see the files are there, looks good