Git状态显示更高级别的未跟踪文件? [英] Git status shows untracked file on a higher level?

查看:93
本文介绍了Git状态显示更高级别的未跟踪文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚从我的服务器克隆了一个git仓库到我的本地机器。我想看看是否一切正常,所以我做了一个git状态,我的惊讶之处在于,比我的git存储库级别更高的文件夹显示为未被跟踪,../joomla/,这对你有意义吗? >

你有一个回购,并且你克隆了它。您从目录运行 git clone url / to / repo.git ,例如 / home / repos / my



现在克隆之后,您可以尝试 git status ,并显示 / home / repos



那么这怎么可能?
$ b $ 1您必须拥有 / home / repos (甚至 .git 文件夹(可能是以前失败的克隆的人工产物等) 2)由于你做了 git clone url / to / repo。 git ,git会在 / home / repos / my / repo 创建一个文件夹仓库。但是你从 / home / repos / my 执行了 git status 。所以git会去寻找 .git 的父文件夹,并找到它(按照1),因此显示未跟踪的文件。



<所以看看2)是否是你的情况。尝试将目录更改为git创建的文件夹。通常你应该做一个克隆为 git clone url / to / repo.git。结尾)如果你已经在您想要回购的文件夹中。


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 higher than my git repository appear as untracked, "../joomla/", does this make any sense to you?

解决方案

( 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.

这篇关于Git状态显示更高级别的未跟踪文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆