Git status shows untracked file on a higher level?

后端 未结 1 1753
盖世英雄少女心
盖世英雄少女心 2021-01-18 13:05

I just cloned a git repository from my server to my local machine. I wanted to see if everything was ok so I made a git status and my suprise is that folders in a level high

相关标签:
1条回答
  • 2021-01-18 13:59

    ( This is a guess since you haven't given a lot of detail. But this is a possible scenario):

    You had a repo and you cloned it. You ran git clone url/to/repo.git from your directory say /home/repos/my

    Now after the clone, you try git status and shows untracked files from /home/repos.

    So how is this possible?

    1) You must have had a .git folder ( probably an artifact of previous failed clone, etc) in /home/repos ( or even /home etc.)

    2) Since you did git clone url/to/repo.git, git would have created a folder repo at /home/repos/my/repo. But you did the git status from /home/repos/my. So git goes to parent folders looking for .git and found it ( as per 1) and hence shows untracked files.

    So see if 2) is your case. Try changing directory to the folder that git has created. Usually you should do a clone as git clone url/to/repo.git . ( . at end) if you are already in the folder where you want the repo to be.

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