5

.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'

文件内容:

* 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

更新:

$ git version
git version 1.8.3.2
4

1 回答 1

4

对于其他用户,这是可能有人收到
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

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

于 2016-07-19T18:11:16.053 回答