【问题标题】:Using Git To Push To Github An Error Occurs使用 Git 推送到 Github 出现错误
【发布时间】:2015-10-28 17:23:18
【问题描述】:

所以我的文件被上传到了 git-GUI。按提交工作正常。单击按钮并询问我的目标存储库,所以我输入https://github.com/myusername/reposistoryname 然后按回车,然后它会询问我的用户名和密码。输入这些项目后,我收到此错误消息。

Pushing to https://github.com/myusername/reposistoryname
To https://github.com/myusername/reposistoryname
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/emaoll/pnz'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我有一个 github 帐户以及 github 上的存储库。

【问题讨论】:

  • 它告诉你应该做什么!

标签: git github git-gui


【解决方案1】:

你需要整合远程brance中的变化(就像消息说的那样),如果你想把变化带来看看,你必须使用..

git fetch origin //Bring all the changes from the remote server

但是,你想推送你的本地更改,那么你必须使用...

git pull //Fetch down new data  from remote server

之后,你就可以正常使用'git push'命令了。其实你也可以用...

git status //This command bring to you some help, about what's next.

我向您推荐,使用(编写这些命令)Git Bash(命令行),-对我来说-更容易。或者,如果您愿意,使用 Git-GUI,只需转到 Remote Menu > Fetch

问候!

【讨论】:

    【解决方案2】:

    您已经写好了...提交您的更改,然后提取数据。拉取成功后,您可以再次推送您的数据。

    【讨论】:

      猜你喜欢
      • 2023-03-16
      • 2016-12-30
      • 2012-10-29
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      • 1970-01-01
      • 2019-06-15
      • 2013-01-31
      相关资源
      最近更新 更多