strange insertion of whitespace after 1st character

I am getting a very strange whitespace issue.

I am working with a local copy of a WordPress site with the .git repo in the wp-content/themes folder so all changes to any theme are tracked etc.

When I set up the repo it considered every file (apart from those in gitignore) as new files and I committed those as the 'initial commit'. 

Firstly is that normal? To have to commit all the files when setting up a new repo?

2nd - and this is the strange behaviour.

when I go to stage these files I get some whitespace inserted after the first character on many of the files.whitespace.jpg

I have the ignore whitespace checked so I am not sure what is causing this.

2 answers

  1. Yes, this is normal.
  2. This is most probably due to your codepage settings. (You use Windows, Git stores CR/LF with the unix codes.) Check your global Git config (usually at c:\Users\<your username>\.gitconfig). In the [core] section, there should be an entry that says autocrlf = true. If it is not there, or set to false, change it.

I found the file, but it is already set to true. Also this isn't happening to all of my repos, just this particular one.

Maybe the config file of the repo (.config in the hidden .git folder) has this set to false?

content of config file in the repo: [core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true hideDotFiles = dotGitOnly

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

546 views 1 2
Read article

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