2

I created a repository on my local machine. I tried to push it to github git push origin master I added the remote repository. git remote add origin git@github.com:.... .git But when I push to the repository it gives an error

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.

Error Message screenshot

  • I removed all the ssh keys from github
  • This is a private repository
1
  • I removed all the ssh keys from github Aug 12, 2018 at 16:58

2 Answers 2

3

You're trying to push via ssh. Missing pub key on the remote or missing private key in the ~/.ssh dir will result in an error. Try using the https protocol. git remote add origin https://github.com/{username}/{repo}.git, then push as usual. Good luck! :)

3
  • 1
    didn't see you already answered yout question. :D Glad u figured it out. Aug 12, 2018 at 17:47
  • 2
    @Vinay666 Upvoting a question means “This question shows research effort; it is useful and clear”. I'm not sure which of these attributes applies to yours. However. Talking someone into upvoting a question isn't considered best practice here, especially if you neither upvoted the answer yourself nor accepted it.
    – PerlDuck
    Aug 12, 2018 at 18:01
  • I figured it out myself and I posted the answer but it says "you can accept your answer in 2 days" imgur.com/a/rSrexHD Aug 13, 2018 at 4:30
0

The thing is I am behind our institute proxy server(HTTP proxy server - IIT KGP). Which does not allow git protocol.I changed git remote add origin git@github.com:.... .git to git remote https://github.com/......git and it worked.Thanks to our institute proxy I am able to post a question and answer on ask ubuntu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.