无法将代码推送到github

时间:2012-06-05 19:12:17

标签: ruby-on-rails ruby-on-rails-3 git github

我尝试使用以下命令将代码推送到github:

git remote add https://github.com/user/sample_app.git

git push origin master

并收到以下错误:

error: failed to push some refs to 'https://github.com/user/sample_app.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.

要查看错误是否在我输入的遥控器上:

git pull

并收到以下错误:

error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/sub1010/sample_app.git/info/refs
fatal: HTTP request failed

为什么我不能将代码推送到github?

2 个答案:

答案 0 :(得分:0)

尝试添加ssh repo而不是http repo

git remote rm sample_app
git remote add git@github.com/user/sample_app.git

答案 1 :(得分:0)

Github有关于设置存储库的详细说明,并确保您可以与其建立连接。链接:Github SetupGithub Create A Repo