我正在尝试将我的django项目推向Gihub
我已经为Windows和Git CLI安装了Github
并遵循所有步骤
但在最后一步我收到错误
To https://github.com/eMahtab/DjangoProject.git
! rejected master -> master (fetch first)
error: failed to push some refs to https://github.com/eMahtab/DjangoProject.git
hint: Updates were rejected because the remote contains work that you do not have
locally. This is usually caused by another repository pushing to the same ref. You may
want to first integrate the remote changes (e.g., git pull ...) before pushing again.
See the Note about fast-forwards in git push --help for details.
答案 0 :(得分:0)
尝试:
git pull
然后你可以推。
答案 1 :(得分:0)
如果git pull
无法解决您的问题,请先尝试克隆项目并将代码复制到克隆的项目中。继续正常进行。这样git就可以为你配置远程跟踪主分支。你最后必须做git push
。
答案 2 :(得分:0)
这是一个经常出现的问题:
git push github master
To git@github.com:Answer_Bot-project/project.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Answer_Bot-project/project.git'
经常重复出现的“解决方案”是使用以下命令的变体:
git fetch github; git merge github/master
Git non-fast-forward updates were rejected Merge the remote changes可能派上用场,它有很多关于你的问题的额外信息。
祝你好运!