简体   繁体   English

快照中不需要的未跟踪文件-Git

[英]Unwanted untracked files in the snapshot - Git

I'm a noob. 我是菜鸟 Here's what I've already done: made a 这是我已经完成的工作:

git init

that created a .git in my home folder. 在我的home文件夹中创建了一个.git

Now, while following the tutorials, I cloned a repository that I had previously created through my account on GitHub , which had a README and a LICENSE file only. 现在,在遵循教程的同时,我在GitHub上克隆了一个以前通过我的帐户创建的存储库,该存储库仅具有README和LICENSE文件。

Now this command: 现在这个命令:

git clone url

was executed from my home directory, and a new folder got created in my home folder with the name, XYZproject. 是从我的主目录执行的,并且在我的主文件夹中创建了一个名为XYZproject的新文件夹。

Now, when I do, 现在,当我这样做时

git status

I get a list of all the files in my home folder as untracked files . 我得到主文件夹所有文件的 未跟踪文件列表 That is, basically. 也就是说,基本上。 I'm confused and in my opinion, this is not what's supposed to be. 我很困惑,我认为这不是应该的。

All I was trying to do, was to try to add files in the XYZproject folder, able to modify it, and to watch these changes get reflected in my account on GitHub. 我要做的就是尝试在XYZproject文件夹中添加文件,能够对其进行修改,并观察这些更改反映在我在GitHub上的帐户中。

Could anyone help me here with what's wrong? 有人可以帮我解决问题吗?

Your first step was unnecessary, you shouldn't have done a git init in your home folder. 第一步是不必要的,您不应该在主文件夹中执行git init You don't need that, you only do that when you want to create a new local repo. 您不需要这样做,只有在要创建新的本地存储库时才这样做。 Since you cloned the repo from your GitHub account, you didn't need to create a local repo. 由于您是从GitHub帐户克隆存储库的,因此您无需创建本地存储库。

Simply delete the .git folder from your home folder. 只需从您的主文件夹中删除.git文件夹。 The. 的。 cd into your cloned folder and work from there. cd进入克隆的文件夹,然后从那里开始工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM