为什么我无法将我的代码推送到github? [英] Why I cannot push my code to github?

查看:321
本文介绍了为什么我无法将我的代码推送到github?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $ git push origin master 
至git@github.com:dimitar9 / first_app.git
! [被拒绝] master - > master(非快速转发)
错误:未能将某些文件推送到'git@github.com:%USERNAME / first_app.git'
为防止您丢失历史记录,非快进更新被拒绝
在再次推送之前合并远程更改(例如'git pull')。有关详细信息,请参阅git push --help的快速转发部分的
'注意事项。


解决方案

这意味着GitHub上有一些更改未合并到您当前的分支中。要解决此问题,请执行错误消息告诉您的内容: git pull ,解决所有冲突,然后再次尝试推送。

$git push origin master
To git@github.com:dimitar9/first_app.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:%USERNAME/first_app.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

解决方案

This means that there are some changes on GitHub which have not been merged into your current branch. To resolve this, do what the error message is telling you to: git pull, resolve any conflicts, then try pushing again.

这篇关于为什么我无法将我的代码推送到github?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆