git、samba、git bash的一個問題
为情所困
为情所困 2017-05-02 09:23:08
0
3
659

問題描述:
我在虛擬機器上面搭建了本地的web LAMP服務,虛擬機器上已經安裝了git,網站根目錄為/var/www/web_root,該目錄用samba映射到windows。

在windows下git clone了專案到samba映射的地方。 現在我用git bash 裡面和虛擬機器裡面分別git status。

結果如下:

1--------------------- windows 下git bash 中git status結果
$ git status
On branch master
Your branch is up-to-date with ' origin/master'.

2--------------------- 虛擬機器linux 下git status結果
[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 ..." to update what will be committed)
(use "git checkout -- .. ." to discard changes in working directory)

。。。。。。 下面是很多的红色标识文件

windows下面git已經配置過(key放在遠端git配置),虛擬機器裡面沒配置過,不知道是不是這個原因,不明白怎麼回事。
請教~~

为情所困
为情所困

全部回覆(3)
PHPzhong

有可能是換行符的問題,windows下換行是CRLF(回車+換行)兩個字符,linux下換行是LF(換行)一個字符;
如果windows下的項目clone到linux後,git會對換行符進行自動處理,將所有CRLF轉換成LF,這導致所有的檔案都發生了變化。
解決思路:禁止git自動轉換換行,或是手動設定git的換行符

给我你的怀抱

windows和linux細節上的不同太多,建議用linux擇只用linux,可以避免很多坑。 。 。

大家讲道理

我也遇到此問題,具體不知道原因,繼續關注此問題。

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!