gitignore - 致命:没有添加文件 [英] gitignore - fatal: no files added

查看:161
本文介绍了gitignore - 致命:没有添加文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



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

  mkdir fold 
cd fold
git init

更新gitignore(如下)

  * .prjx 

提交gitignore

  git add。 gitignore 
git commit -m更新gitignore

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

  git add * 

我收到下面的消息

 以下路径会被一个.gitignore文件忽略:
ftc.prjx
如果您真的想添加它们,请使用-f。
致命:没有添加文件

我不想添加它,我只是想添加所有其他文件和文件夹。
根据我的理解,gitignore应该正确处理,那么为什么我会收到上面的消息?
我错过了什么?

解决方案

您应该运行 git add。而不是 git add *



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


I have an issue with git, more precisely with gitignore.

I have created an empty folder Initialized git

mkdir fold
cd fold
git init

Updated gitignore (as below)

 *.prjx

Committed gitignore

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

Now I have several files (among them a .prjx) and folders in my root (fold) and I'd like to add all of them, but when I run

git add *

I get the message below

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

I don't want to add it, I simply want add all the other files and folders. From my understanding .gitignore should handle exactly that so why I get the message above? Am I missing something?

解决方案

you should run git add . rather than git add *

the * is interpreted by the shell and substituted with all file and folder in the current location. obviously ftc.prjx is one of them and git is just warning that the file is in the ignorelist.

这篇关于gitignore - 致命:没有添加文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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