git commit 失败"Untracked files,Changes not staged for commit" 问题的解决

问题描述

$ git commit
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
Changes not staged for commit:
        modified:   SUMMARY.md

Untracked files:
        mcloudv2/

no changes added to commit

git commit之后,提示git commit失败,提示Untracked files,Changes not staged for commit。也就是说,这个文件在commit之前需要先把文件放入暂存区。

这里有一句(use “git push” to publish your local commits),试一下git push,并不管用

问题解决

解决的办法很简单,只需要在commit之前add一下文件即可。

$ git add SUMMARY.
fatal: pathspec 'SUMMARY.' did not match any files

然后再commit一下就没有问题了。

你可能感兴趣的:(git commit 失败"Untracked files,Changes not staged for commit" 问题的解决)