【问题标题】:Unable to Commit Changes to Github Pages无法提交对 Github 页面的更改
【发布时间】:2020-06-14 05:03:05
【问题描述】:

我已将我的投资组合部署到我在 a.github.io 上的帐户。

我做了一些更改,但它们没有在网站上上线。事实上,即使我在 Visual Studio 上进行了更改,提交部分也没有显示任何提交。

如果我提交更改,我会得到

On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
modified: node_modules/gh-pages/.cache/github.com!a!a.github.io.git (new commits)

no changes added to commit 

即使我正在做出改变。

所以我的更改不会生效。

编辑:

现在,提交工作了,但是当我推送更改时我得到了这个:

 ! [rejected]          master -> master (fetch first)
error: failed to push some refs to 'https://github.com/a/a.github.io.git'
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 上,但网站没有更新@VonC​​pan>

标签: git visual-studio github terminal github-pages


【解决方案1】:

如果您进行了任何更改,git status 应该会显示它们,并且您应该在某个时候完成 git add + git commit。

如果推送仍然失败,请检查您的 git status 是否显示分支。


如果不是,您处于 detached HEAD 模式,这可以解释为什么不推送提交。

git switch -c tmp
git switch -C master tmp

这会将 master 重置为当前(分离的 HEAD)提交。


如果你得到:

new file...

您至少需要执行git add+git commit,但再次检查当前分支。

【讨论】:

  • 如果我执行 git status,我会得到 ``new file: src/assets/font-awesome/svgs/solid/archway.svg`` 的所有内容
  • 上面写着git: 'switch' is not a git command. See 'git --help'.
  • 我过去没有经常使用 git。作为初学者,能解释一下吗?
  • @x89 git switch 是 Git 2.23+:你能轻松更新吗?你在哪个操作系统上?
  • @x89 首先,git status 返回什么?
猜你喜欢
  • 2011-08-20
  • 2019-07-31
  • 2011-12-21
  • 2021-11-21
  • 1970-01-01
  • 2019-01-04
  • 1970-01-01
  • 1970-01-01
  • 2018-01-20
相关资源
最近更新 更多