最近两年在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 错误-------------------------------------------------------------------------[[email protected] 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”,发生如下错误:
--------------------------------------------------------------------------
[[email protected] 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
时间: 2024-10-19 15:13:36