0

when i try to push something form local git to github this happens & i don't know how to solve that .


warning :permanently added the RSA host key for ip addres '......' to the list of known hosts permission denied (publickey) fatal:could not read from remote repository please make sure you have the correct access rights and the repo exits


knowing that i used this commands before that happens Mkdir ~/Name cd ~/Name git init git remote add orgin git remote add orgin git@github.com:Myacc touch file git add . git commit -m "add Name" git push orgin master (Error happend ) git pull orgin master git push orgin master

So what should i do ?

E.khaled
  • 49
  • 2

2 Answers2

0

Try to specify the username that SSH should send to the remote system as part of your remote's URL. Put the username, followed by an @, before the remote hostname.

Stanimir Yakimov
  • 864
  • 3
  • 14
  • 31
0

There can be many reasons for this problem. But one very common reason can be public key is not set on your git shell.

Try following steps to check your SSH public key.

  1. run this command on your terminal:

    ssh-agent -s

    ssh-add -l

  2. Now open github.com and login your account. you will see SSH keys in settings option. compare that SSH key with the key generated by above command.

for other reasons you can see git help here : https://help.github.com/articles/error-permission-denied-publickey/

Thanks,

Bhavik

Bhavik Patel
  • 193
  • 1
  • 8
  • Thanks , but i can't get it , i used the both commands but no keys appear so how can i compare them , before i generated a key and put it in the ssh key at github after that when i trying to push the file its rejected – E.khaled Apr 11 '15 at 21:36
  • That is what appear after i use git push command Username for 'https://github.com': Asizux Password for 'https://Asizux@github.com': To https://github.com/Asizux/datasciencecoursera.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/Asizux/datascienceco a.git' hint: Updates were rejected because the tip of your current branch is behin hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. – E.khaled Apr 11 '15 at 21:58
  • According to your this error "Updates were rejected because the tip of your current branch is behind", you may have rebase your local commits. For that try using "git push --force" command. And use it very carefully. Because it will push the commits forcefully (non-fast-forward). – Bhavik Patel Apr 12 '15 at 04:45