首先打开Key保存的位置,里面会有三个文件,找到id_rsa.pub,用文本编辑器打开,复制里面的全部字符。到GitHub,在右上方工具栏里找到Account Settings。在这个页面上有一个SSH Public Keys标签,选择Add another public key。Title可以随便填一个,Key就粘贴刚才的字符,提交。
如果输入 git push origin master
提示出错信息:error:failed to push som refs to …….
解决办法如下:
1、先输入 git pull origin master //先把远程服务器github上面的文件拉下来
2、再输入 git push origin master
3、如果出现报错 fatal: Couldn’t find remote ref master或者fatal: ‘origin’ does not appear to be a git repository以及fatal: Could not read from remote repository.