登陸到遠程linux服務器上,使用git, clone的時候報“fatal: Unable to find remote helper for 'https'”錯,沒管,繞過,使用git clone git://....協議download下來項目。
但是到提交完要push回服務器的時候,必須得用https,搜了一下問題,是系統中沒有curl,都是要裝curl的,比如:
yum install curl-devel
或者apt-get等
但是問題來了,遠程服務器上沒有sudo到root的權限怎么辦?
得自己安裝curl,從http://curl.haxx.se/download.html下載到最新的curl包:
解壓,然后make並安裝:
./configure --prefix=/home/{username}/curl/
make
make install
安裝好后,再嘗試git push,還是報一樣的錯。
想到應該需要重新編譯並安裝git,執行:
./configure --prefix=/home/{username}/git/ --with-curl=/home/{username}/curl/
注意這里一定要使用--with-curl參數,指定到上面安裝的curl目錄,git只有與curl庫做link之后,才能使用https功能。
再次make & make install
git push成功。
本次解決問題的經驗教訓:
實際上是重新編譯時先使用./configure --prefix=/home/{username}/git/未果后才思考的,執行./configure --prefix=/home/{username}/git/ &> config.log,把log重定向到這個文件里打開,搜curl,發現curl的狀態是no,表明這個configure沒有找到curl,那么自然后面在make的時候也就無法完成link,然后./configure -h,看到--with-curl參數,想起需要指定,才搞定問題。
經驗教訓是遇到問題還是要自己思考一下原理,網上搜的文章都是有root權限的前提下能裝到系統默認位置的方案,沒有想原理,另外要注意觀察日志,幫助理解問題。
參考鏈接:http://stackoverflow.com/questions/8329485/git-clone-fatal-unable-to-find-remote-helper-for-https