首页 > 其他 > 详细

第一次提交代码到github时经常遇到的问题

时间:2015-05-29 19:47:36      阅读:248      评论:0      收藏:0      [点我收藏+]
最近两年在OpenStack方面做了一些工作,写了一些实验性的plugin. 本着Open Source的共享精神,想尝试提交到github,以便他人能下载使用。
当你注册完github帐号之后,点击有上面的“+”图标创建一个source code的repository。
下面以我的monasca plugin for heat 为例。
执行一下几步可以第一次提交你的代码:
------------------------------------------------------------------------
echo # monasca-plugin-4-heat >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/duanlg/monasca-plugin-4-heat.git git push -u origin master
-------------------------------------------------------------------------

然而在最后一步执行“
git push -u origin master”时会遇到如下的几个问题。

1)HTTP request failed 错误
-------------------------------------------------------------------------
[garygit@hikari monasca-plugin-4-heat]$ git push -u origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/duanlg/monasca-plugin-4-heat.git/info/refs
fatal: HTTP request failed
-------------------------------------------------------------------------
解决方法:
默认的.git/config里关于url是这样写的:
-------------------------------------------------------------------------
url = https://github.com/duanlg/monasca-plugin-4-heat.git 
-------------------------------------------------------------------------
修改如下:
-------------------------------------------------------------------------
url = https://<username>@github.com/<username>/monasca-plugin-4-heat.git 
-------------------------------------------------------------------------
2) cannot open display 错误
   然后重新执行“git push -u origin master”,发生如下错误:


   --------------------------------------------------------------------------

[garygit@hikari monasca-plugin-4-heat]$ git push -u origin master
(gnome-ssh-askpass:1322): Gtk-WARNING **: cannot open display:

  --------------------------------------------------------------------------------------

解决办法:
查看环境变量SSH_ASKPASS的值,默认为“/usr/libexec/openssh/gnome-ssh-askpass”。
直接“unset SSH_ASKPASS”即可解决。

 P.S.

关于提交代码的详细步骤,参考如下:How to use git.md

https://github.com/peterluo/LearningPythonDiary/blob/master/1.How%20to%20use%20git.md

第一次提交代码到github时经常遇到的问题

原文:http://www.cnblogs.com/duanlg/p/4539047.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!