gpt4 book ai didi

gitignore - 致命的 : no files added

转载 作者:IT王子 更新时间:2023-10-29 00:43:30 28 4
gpt4 key购买 nike

我对 git 有疑问,更准确地说是对 gitignore。

我创建了一个空文件夹初始化git

mkdir fold
cd fold
git init

更新的 gitignore(如下)

 *.prjx

提交 gitignore

git add .gitignore
git commit -m "update gitignore"

现在我的根目录中有几个文件(其中有一个 .prjx)和文件夹(折叠),我想添加所有这些文件,但是当我运行时

git add *

我收到下面的消息

The following paths are ignored by one of your .gitignore files:
ftc.prjx
Use -f if you really want to add them.
fatal: no files added

我不想添加它,我只想添加所有其他文件和文件夹。根据我的理解,.gitignore 应该完全处理这个问题,所以为什么我会收到上面的消息?我错过了什么吗?

最佳答案

你应该运行 git add . 而不是 git add *

* 由 shell 解释并替换为当前位置的所有文件和文件夹。显然 ftc.prjx 是其中之一,git 只是警告该文件在忽略列表中。

关于gitignore - 致命的 : no files added,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12084227/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com