Thread (33 messages) flat view 33 messages, 13 authors, 2016-08-11

Re: CRLF problems with Git on Win32

From: Steffen Prohaska <hidden>
Date: 2016-06-15 22:44:02

On Jan 7, 2008, at 10:16 AM, Peter Karlsson wrote:
When I clone git://git.debian.org/git/turqstat/turqstat.git using the
msys-Windows version of git (1.5.4-rc2), some but not all the files  
get
autoconverted to CRLF. Is it possible to set properties for the files
that are text, to make sure they are converted properly?
Per default, CRLF conversion is disabled in msysgit.  Git should
not convert a single file.  Does it really convert some?

You can verify that CRLF conversion is off by running

     git config core.autocrlf

which should just print an empty line.

You can enable automatic conversion for all text files by running

     git config core.autocrlf true

(this can be set on a per-repository basis or you can set a
  default for your account if you pass the '--global' option.)

A difficulty you'll run into is that you need to set
"core.autocrlf true" before you checkout.  But because git clone
fuses git init, git fetch, and git checkout into a single
operation, you can't use it as is if you like to enable CRLF
on a per-repository basis (it works if you set a global default).

You can either use

     git clone -n URL  # -n tells clone to stop before checkout
     cd turqstat
     git config core.autocrlf true
     git checkout -b master origin/master

or you can manually do what clone would do for you, i.e.

     mkdir turqstat
     cd turqstat
     git init
     git config core.autocrlf true
     git remote add origin git://git.debian.org/git/turqstat/ 
turqstat.git
     git fetch origin
     git checkout -b master origin/master

(this is what I typically do).

BTW, I think that git clone should be improved to avoid the
workaround described above.  Maybe it could ask the user if it
should set up a specific line ending conversion before checkout.
Unfortunately, I had no time to write a patch, yet.

	Steffen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help