Git - Won't add files?

后端 未结 29 2130
小蘑菇
小蘑菇 2020-12-13 12:01

I\'m having issues where I can\'t add files to my repository.

I\'m using GIT on windows, in Aptana Studio for some Ruby development.

I\'ve managed to push a

29条回答
  •  旧巷少年郎
    2020-12-13 12:33

    I am still a beginner at git, and it was just a stupid mistake I made, long story in one sentence. I was not in a subfolder as @gaoagong reported, but the other way round, in a parent folder. Strange enough, I did not get the idea from that answer, instead, the idea came up when I tested git add --all, see the long story below.

    Example in details. Actual repo:

    The Parent folder that I had opened mistakenly on parent level (vscode_git in my case):

    I had cloned a repo, but I had a parent folder above this repo which I had opened instead, and then I tried adding a file of the subfolder's repo with git add 'd:\Stack Overflow\vscode_git\vscode-java\.github\ISSUE_TEMPLATE.md', which simply did nothing, no warning message, and the git status afterwards said:

    nothing added to commit but untracked files present (use "git add" to track)

    Running git add --all gave me the yellow notes:

    warning: adding embedded git repository: vscode-java the embedded repository and will not know how to obtain it.

    hint: If you meant to add a submodule, use: git submodule add vscode-java

    hint: If you added this path by mistake, you can remove it from the index with git rm --cached vscode-java

    See "git help submodule" for more information.git

    To fix this, I reverted the git add --all with git rm --cached -r -f -- "d:\Stack Overflow\vscode_git\vscode-java" rm 'vscode-java':

    Then, by simply opening the actual repo folder instead,

    the git worked as expected again. Of course the ".git" folder of the parent folder could be deleted then:

提交回复
热议问题