Search code examples
git-push

git push origin master> fatal: HTTP request failed


When I do Git push, I get the following error message -

  Username: 
  Password: 
  error: The requested URL returned error: 403 while accessing https://github.com/Selvam-T/hw4_rottenpotatoes.git/info/refs

My Git clone read-only address is https://github.com/Selvam-T/hw4_rottenpotatoes.git

I followed the suggestion and changed the repo config to ssh way like this -

git remote set-url origin ssh://git@github.com/Selvam-T/hw4_rottenpotatoes.git

Then the error message I got, when I did "git push origin master", is this -

  ssh: Could not resolve hostname github.com:Selvam-T: Name or service not known
  fatal: The remote end hung up unexpectedly

How can I fix either one of those communication issue?


Solution

  • You can use https or ssh address to push.

    But for https, you need a ~/.netrc (or %HOME%\_netrc on Windows, which supposes you have defined a HOME environment variable), with your GitHub credentials in it.
    See "Syncing with github" or "need github without username and password" for an example.

    And for ssh, you need a private / public keys in ~/.ssh, with the public key published to your repo and a ~/.ssh/config file.
    See "Why doesn't my SSH key work for connecting to github?" for more.