1、上传ssh时,服务器验证不过:
如果电脑上有ssh key,要将就有的备份并删除(直接删除文件即可),如果没有,输入以下命令:
$ ssh-keygen -t rsa -C "邮件地址@youremail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):<回车就好>
尤其注意第三行,应该直接回车,而不是输入自定义的文件名。然后将生成的id_rsa.pub的内容原封不动上传到git,之后测试命令:
ssh -T git@github.com
选择“yes”,输入用户名和密码,提示成功!
2、error: failed to push some refs to 'https://github.com/
git push代码时需要将远程仓库的文件拉下来(pull)然后push上去。
git的本地仓库由git维护的三棵树组成,第一棵是我的工作目录,它持有实际文件,第二棵是缓冲区(Index),保存临时改动,第三棵是head,指向最后提交后的结果。
git add <filename>
是将文件提交到缓存区,应该是“计划改动”,然后实际提交改动:
git commit -m "代码提交信息"
这时候改动已经提交到head,但是还没有到达远程仓库,调用:
git push origin master
则是将改动提交到远程仓库,如果还没有克隆现有仓库,并欲将仓库连接到某个远程服务器,可以使用如下命令添加:
git remote add origin <server>
错误:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解决办法:
Elvis@ELVIS-PC /f/gitrepo/TestJedis (master)
$ git remote add origin git@gitserver:TestRedis.git
Elvis@ELVIS
-PC /f/gitrepo/TestJedis (master)
$ git push origin master
ssh: gitserver: no address associated with name
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Elvis@ELVIS
-PC /f/gitrepo/TestJedis (master)
$ git remote set
-url origin git@github.com:afredlyj/TestRedis.git
Elvis@ELVIS
-PC /f/gitrepo/TestJedis (master)
$ git push origin master
Enter passphrase
for key '/c/Users/Elvis/.ssh/id_rsa':
Counting objects:
8, done.
Delta compression using up to
2 threads.
Compressing objects:
100% (7/7), done.
Writing objects:
100% (7/7), 2.07 KiB, done.
Total
7 (delta 2), reused 0 (delta 0)
To git@github.com:afredlyj
/TestRedis.git
7bcfb1a..b02a2fe master
-> master
Elvis@ELVIS
-PC /f/gitrepo/TestJedis (master)
借鉴地址:http://stackoverflow.com/questions/3283717/github-no-address-associated-with-name 参考资料:
http://rogerdudler.github.io/git-guide/index.zh.html
https://help.github.com/articles/set-up-git
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com