Team Development for Sitecore (TDS) with Github
f your using Team Development for Sitecore (TDS) and Github or Git as your source control you may experience an issue where TDS is unable to create/update some of the items in Sitecore, due to a content length issue.
The error will look something like this:
Failed to load version 1 for language en Length of field content does not match the content-length attribute. File name: name, field id: {id}
What's happening comes down to how Github encodes line ending. If your item contains a Rich Text field you can end up with data that has been serialized with both CRLF and LF as the line feed. This will have been included in the content length. However when you push to Git, the CRLF value will have been removed making the content length value incorrect.
To overcome this issue you need to update your .gitattributes file to treat these files differently. Just add this to your file:
# TDS files should be treated as binary *.item -text
How do I create a .gitattributes file?
If you don't have a .gitattributes file you may run into an issue with windows where it won't let you create it, due to requiring a file-name rather than just an extension.
To create the file:
- Create the text file gitattributes.txt
- Open it in a text editor and add your rules, then save and close
- Hold SHIFT, right click the folder you're in, then select Open command window here
- Then rename the file in the command line, with ren gitiattributes.txt .gitattributes