Problem description:
I have built a local web LAMP service on a virtual machine. Git has been installed on the virtual machine. The root directory of the website is /var/www/web_root. This directory is mapped to windows using samba.
In Windows, git cloned the project to the samba mapping location. Now I use git status inside git bash and inside the virtual machine.
The results are as follows:
1--------------------- The result of git status in git bash under windows
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
2--------------------- git status results under virtual machine linux
[root@yangshushu jnexpertweb]# git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
。。。。。。 下面是很多的红色标识文件
Git has been configured under Windows (the key is placed in the remote git configuration), but it has not been configured in the virtual machine. I don’t know if this is the reason, and I don’t understand what’s going on.
Ask me~~
PHPz2017-05-02 09:25:08
It may be a problem with line breaks. Under Windows, a line break is two characters CRLF (carriage return + line feed), and under Linux, a line break is one character LF (line feed);
If a project under windows is cloned to Linux, git will wrap the line Characters are automatically processed to convert all CRLF into LF, which causes all files to change.
Solution: Disable git from automatically converting line breaks, or manually set git's line breaks
给我你的怀抱2017-05-02 09:25:08
There are too many differences in details between windows and linux. It is recommended to use linux instead of linux to avoid many pitfalls. . .
大家讲道理2017-05-02 09:25:08
I also encountered this problem. I don’t know the specific reason. Please continue to pay attention to this issue.