git - 无法提交对 Github 页面的更改
问题描述
我已将我的投资组合部署到我在 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.
解决方案
如果您进行了任何更改,git status 应该会显示它们,并且您应该在某个时候完成 git add + git commit。
如果推送仍然失败,请检查您的 git status 是否显示分支。
如果不是,您处于分离 HEAD模式,这可以解释为什么不推送提交。
git switch -c tmp
git switch -C master tmp
然后,这会将 master 重置为当前(分离的 HEAD)提交。
如果你得到:
new file...
至少你需要做一个git add
+ git commit
,但再次检查当前分支。
推荐阅读
- dataframe - Deedle F# - 查找索引组中的最大行数
- php - 将 curl 命令转换为 PHP 用于 csv->Excel 转换器
- git - 没有用户名的 git pull 问题
- python - 逐个函数计算执行时间?
- python - 使用 boto3 列出 AWS 上的所有私有和公共服务
- java - 在neo4j中创建索引后,使用java api操作“findNode”函数时出现“java.lang.UnsupportedOperationException”
- python - AWS lambda 无法识别部署包中的 python 模块
- docker - 如何让容器关闭 Kubernetes 中的主机?
- php - laravel 5.6 与 guzzlehttp 6 试图获取非对象标题的属性
- javascript - ember 中的 helper 'andThen' 与传统的 'then' 有何不同