Troubleshooting misplaced .git directory (nothing to commit)

后端 未结 16 1339
死守一世寂寞
死守一世寂寞 2020-12-05 01:42

I started getting this message. No matter what I edit and try to commit, it says there is nothing to commit. Looks like git does not see my working directory and looking som

相关标签:
16条回答
  • 2020-12-05 02:17

    In my case I had previously initialized a git directory where I was trying to create a new one. I just deleted all the old files and started from scratch.

    0 讨论(0)
  • 2020-12-05 02:18

    try removing the origin first before adding it again

    git remote rm origin
    git remote add origin https://github.com/abc/xyz.git
    
    0 讨论(0)
  • 2020-12-05 02:23

    Check the location whether it's the right location of the git project.

    0 讨论(0)
  • 2020-12-05 02:23

    I have faced the same issue with git while working with angular CLI 6.1.2. Angular CLI 6.1.2 automatically initializes .git folder when you create a new angular project using Angular CLI. So when I tried git status - it was not detecting the whole working directory.

    I have just deleted the hidden .git folder from my angular working directory and then initialized git repository again with git init. And now, I can see all my files with git status.

    0 讨论(0)
  • 2020-12-05 02:25

    Encountered this while using SourceTree, fixed it by

    1. First stash your current uncommitted changes.
    2. Apply / Unstash the same changes using Sourcetree.

    Worked like a charm.

    0 讨论(0)
  • 2020-12-05 02:26

    Go to your workspace folder

    1. find .git folder
    2. delete the folder and its contents
    3. use git init command to initialize.

    Now it will show what all the files can be committed.

    0 讨论(0)
提交回复
热议问题