windows git clone Warehouse Code newline problem

    Today, a problem occurs very egg pain, git code above, after the clone down after Build.sh not work through the next docker clone on the windows, the code is found to be a line break windows , execution will be given:

[worker@newdev php-msf-demo]$ ./server.php
-bash: ./server.php: /home/worker/php/bin/php^M: bad interpreter: No such file or directory

Instead unix newline, perform no error, but without any response, failed to start.
[@ newdev worker PHP-msf-Demo] $ ./server.php
[worker @ newdev PHP-msf-Demo] $

So mention the issue, the result of an own trouble, said to be the editor of my local problems, then there is no code repository composer install, this is the most boring, and always forget.

    After down back home, re-clone, still found the windows line breaks, under final consideration is not git clone would not be a problem in linux below, the results tried it, it really is the problem. Online collecting a bit and finally found the solution:

Not due to line breaks Editor incorrectly, but because docker under windows, clone out the code Line breaks are automatically converted.
Solution:
git config -global core.autocrlf the INPUT

The code in the clone down the remains of the original warehouse line breaks.

In fact, when installing git has options:

Checkout Windows-style, commit Unix- style line endings
when detected in a text file, Git will convert LF to CRLF. When submitting a text file, CRLF will be converted to LF. For cross-platform project, which is recommended for Windows systems. ( "Core.autocrlf" is set to " true")

Checkout as-is, commit Unix- style line endings
when detected in a text file, Git will not do any conversion. When submitting a text file, CRLF will be converted to LF. For cross-platform project, which is the recommended setting for Unix systems. ( "Core.autocrlf" is set to " input")

Checkout as-is, commit as- is
when either the detection or submit a text file, Git will not do any conversion. For cross-platform project, this option is not recommended.

Now that though they are developed under the windows, but many are using virtual machines, so git or the use of a second better

Be the First to comment.

Guess you like

Origin blog.csdn.net/wccczxm/article/details/89379132