2014-01-13 60 views
1

在設置.git/info/attributes文件中的屬性時出現以下錯誤。文件「openssl」]不是有效的屬性名稱:.git/info/attributes:5

$ 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 
+3

'[merge]','[filter ...]'和'[diff ...]'東西不會進入你的'。git/info/attributes'文件。它在'.git/config'或'$ {HOME} /。gitconfig'中。使用'git help gitattributes'和'git help config'來閱讀這兩種文件的描述。 – twalberg

+0

@twalberg:謝謝......你是對的 – twid

回答

0

對於其他用戶,這裏是另一個原因WY有人可能會得到一個
is not a valid attributes name .gitattributes:2錯誤消息。

冒號後面的數字是.gitattributes文件中的違規行號。
regardelss FO具體的修復,
這是.gitattributes不懂行,
即「xxx是不是一個有效的屬性名稱..」

在我的答案在消息中的第一個字符是一個 '空間'
在海報的消息,這是 '爲 「OpenSSL」]'

錯誤消息:
is not a valid attribute name: .gitattributes:2

原因:
您正在設置屬性值 ,但是您在等號周圍放置了空格。 只需刪除空格!

SOLUTION:
相反的: .htaccess merge = ours 考慮: .htaccess merge=ours

症狀:
您添加一個新的gitattributes文件或行和 運行git的地位, 收到此錯誤或類似的: 不是有效的屬性名稱:.gitattributes:1

爲什麼你可能在你的文件中有這樣的內容:
Git Book錯誤地發佈了帶有等號周圍空格的例子。 它不應該有。

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

這在我的文件固定的錯誤。
顯然海報的文件有一個不同的問題/解決方案
這是爲其他用戶添加了解其他可能的修復類似的錯誤信息。

相關問題