Whitespace Problems in a Windows / FTP / Mac Environment

Matthew Pinto March 5, 2014

Hi,

We are configuring SourceTree for our dev environment. I am on a Mac and my partner on a Windows 7 PC. We have a master repo set up on a NAS and clone locally to our own machines. We typically work on a site via FTP on an external server, then copy our modified files over to our local clone directory, review, commit, and push up to the master repo.

We are having an apparent issue with Line Endings between Windows and Mac. When I download a file from the FTP server to my local clone, SourceTree identifies every file as being modified. I know that you can toggle 'Ignore Whitespace', which works to ignore these non-changes, but in the list of Pending files, every file still appears to be modified, and shows up in the Commit list as well.

There are several SO answers regarding .gitattributes which we've tried, with no luck.

Do you have any tips for fixing this issue?

Thank you!

2 answers

1 accepted

0 votes
Answer accepted
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2014

If the shared server is Linux-based and you have SSH access, I'd recommend running dos2unix (for the mac) or unix2dos (for windows) on the entire batch prior to downloading. You may consider looking for FTP clients or local utilities that make these conversions for you instead.

0 votes
Matthew Pinto March 22, 2014

Thanks Seth. The answer was to install homebrew and then use the terminal, filtering by filetype to convert some dos files to linux and vice versa:

find . -name "*.css" -type f -exec unix2dos {} \;

find . -name "*.php" -type f -exec unix2dos {} \;

find . -name "*.js" -type f -exec dos2unix {} \;

find . -name "*.svg" -type f -exec dos2unix {} \;

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events