首页 > 解决方案 > Git状态命令-未跟踪文件下的整台计算机

问题描述

我对 github 很陌生。今天我在路径 Desktop/Projects 中,并在其中创建了一个新目录:

mkdir 简历

在里面运行命令:

echo "# CV" > README.md

因为我想在 CV 目录中创建一个自述文件并在其中写入 #CV.

在这个阶段,我想将我的文件添加到 Github,所以我去了 Github 网站并创建了一个新的 repo。然后回到终端,在做任何其他事情之前,我首先检查了 git status ,结果就是这样:

警告:无法打开目录 'Pictures/Libreria di Foto.photoslibrary/':在分支主机上不允许操作

还没有提交

未跟踪的文件:(使用“git add ...”来包含将要提交的文件)

.CFUserTextEncoding
.DS_Store
.adobe/
.atom/
.bash_history
.bash_profile
.bash_sessions/
.bashrc
.bundle/
.cache/
.config/
.cups/
.dropbox/
.gem/
.gitconfig
.gnupg/
.irb-history
.local/
.mkshrc
.oh-my-zsh/
.oracle_jre_usage/
.profile
.rvm/
.ssh/
.subversion/
.swp
.viminfo
.zcompdump-MacBook Air di Emanuele-5.3
.zlogin
.zoomus/
.zsh_history
.zshrc
.zshrc.pre-oh-my-zsh
Applications/
Creative Cloud Files/
Desktop/
Documents/
Downloads/
Dropbox/
Library/
Movies/
Music/
Parallels/
Pictures/
Public/
myFile
my_final_project/

我的电脑目前是完整的未跟踪文件。我没有在任何地方做 git init 。我还尝试按照另一个 stackoverflow 主题中的答案的步骤进行操作,但没有成功。

标签: gitgithubgit-statusgit-initgit-untracked

解决方案


除了答案“删除~/.git”之外,您还可以.git通过执行git rev-parse.

如果您位于存储库的根目录,它将.git返回,否则它将返回存储库.git文件夹的绝对路径。


推荐阅读