0

I have a public key with GitHub. Just made it today. I closed Git and launched it back again and now its not pushing my projects. It generates the following error:

Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

As well when I try executing the following command: git remote add origin I get the following message: fatal: remote origin already exists.

Can someone please help. I have spent a lot of time trying to use suggested solutions on here, but none worked for me. Lastly, do I need to initialize Git to my public key directory and make sure access is successful to GitHub every time I launch Git?

4
  • Can you tell us what you've tried already, so we don't suggest duplicate solutions? Commented Apr 23, 2016 at 4:22
  • stackoverflow.com/questions/10904339/… Commented Apr 23, 2016 at 4:24
  • stackoverflow.com/questions/19660744/… Commented Apr 23, 2016 at 4:24
  • I had the problem and then I followed the instructions on GitHub to make SSH key. I did and was given access, but still I cant push anything. Its my first time doing this and I don't know what am I doing wrong Commented Apr 23, 2016 at 4:27

1 Answer 1

1

The error 'fatal: remote origin already exists' means that you have already done

git remote add origin 'your git repo'

To remove the origin, do this:

git remote rm origin

And redo the command:

git remote add origin 'your git repo'

Example:

git remote add origin https://github.com/YourUsername/YourProject.git

Also make sure that the repository exists and is created on GitHub, and you have access to it.

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you so much. It worked. I removed the origin and redid the command but instead of using [email protected]:/UserName/Project.git, I used what you gave me: github.com/YourUsername/YourProject.git
In the place of YourUsername and YourProject, you put your github username and your github project. An example could be mine: git remote add origin https://github.com/Li357/SudokuSolver.py And if I you could be willing, give me a thumbs and the selected answer :)
what I meant is gitHub gives the following command: git remote add origin [email protected]:UserName/Project.git. instead I used: git remote add origin github.com/UserName/Project.git. instead of [email protected] I used what you gave me github.com
I gave you thumbs up, but since I am new its saying it wont show until I earn 15 points. I guess I have to go answer some easy programming questions to earn those points lol
Sure, so if you could give me the repository you are trying to add as a remote I could give you the command to type. You can select it as the best answer :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.