在Windows上使用Git将项目推送到Github

在Windows上使用Git将项目推送到Github,git,github,github-for-windows,Git,Github,Github For Windows,我正试图把我的django项目推向Gihub 我已经安装了Github for windows和Git CLI 并遵循所有的步骤 首先使用自述文件在github上创建了一个Repo(默认) 创建了一个简单的django应用程序 git初始化 git添加 git提交-m“首次提交” git远程添加源 git推送源主机 但在最后一步,我得到了错误 To https://github.com/eMahtab/DjangoProject.git ! rejected master -&g

我正试图把我的django项目推向Gihub

我已经安装了Github for windows和Git CLI

并遵循所有的步骤

  • 首先使用自述文件在github上创建了一个Repo(默认)
  • 创建了一个简单的django应用程序
  • git初始化
  • git添加
  • git提交-m“首次提交”
  • git远程添加源
  • git推送源主机
  • 但在最后一步,我得到了错误

    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.
    
    试着做:

    git pull 
    

    然后可以推送。

    如果git pull不能解决问题,请先尝试克隆项目,然后将代码复制到克隆的项目中。照常进行。这样git就可以为您配置远程跟踪主分支。最后你只需要做一次git推送

    这是一个经常重复出现的问题:

    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
    
    可能会派上用场,这有很多关于你的问题的额外信息

    祝你好运

    可能重复的