“openssl”] 不是有效的属性名称:.git/info/attributes:5

twi*_*wid 5 git gitattributes

.git/info/attributes文件中设置属性时出现以下错误。

$ git add --dry-run . 
"openssl"] is not a valid attribute name: .git/info/attributes:5
"openssl"] is not a valid attribute name: .git/info/attributes:8
add '.gitignore'
add 'README.md'
Run Code Online (Sandbox Code Playgroud)

文件内容:

* filter=openssl diff=openssl

[merge]
        renormalize=true
[filter "openssl"]
        smudge=~/.gitencrypt/smudge_filter_openssl
        clean=~/.gitencrypt/clear_filter_openssl
[diff   "openssl"]
        textconv=~/.gitencrpt/diff_filter_openssl
Run Code Online (Sandbox Code Playgroud)

更新:

$ git version
git version 1.8.3.2
Run Code Online (Sandbox Code Playgroud)

She*_*man 5

对于其他用户来说,这是可能会收到错误消息的另一个原因
is not a valid attributes name .gitattributes:2

冒号后面的数字是 .gitattributes 文件中有问题的行号。
对于具体的修复,
这是 .gitattributes 不理解的行,
即“xxx 不是有效的属性名称..”

在我的回答中,消息中的第一个字符是“空格”,
在海报的消息中,它是““openssl”]'

错误信息:
is not a valid attribute name: .gitattributes:2

原因:
您正在设置属性值,但在等号两边放置了空格。只需删除空格即可!

解决方案:
而不是: .htaccess merge = ours 考虑: .htaccess merge=ours

症状:
您添加新的 gitattributes 文件或行并运行 git status,并收到此错误或类似错误:不是有效的属性名称:.gitattributes:1

为什么你的文件中可能有这个:
Git Book错误地发布了等号周围带有空格的示例。不应该有。

参考: http:
//www.stegriff.co.uk/upblog/gitattributes-error-is-not-a-valid-attribute-name

这修复了我的文件中的错误。
显然,发帖人的文件有不同的问题/解决方案,
这是为了其他用户了解类似错误消息的其他可能修复而添加的。