Whitespace Problems in a Windows / FTP / Mac Environment

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

Accepted Answer
0 votes

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.

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
Community showcase
Posted Tuesday in Featured Groups

Tuesday tips & tricks: What is the Atlassian Community?

It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...

132 views 6 8
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you