- # 切到 git 用戶測試
- su git
- # 可能會輸出以下錯誤
- fatal: Interactive git shell is not enabled.
- hint: ~/git-shell-commands should exist and have read and execute access.
- # 解決方法是複製 git-shell-commands 目錄到 git 用戶目錄
- cd /home/git
- cp -Rf /usr/local/share/git-core/contrib/git-shell-commands .
- # 再來改變權限
- chown -R git: git-shell-commands/
- chmod +x git-shell-commands/help
- chmod +x git-shell-commands/list
- # 找出 git-shell 位置
- which git-shell
- # 之後修改 git 用戶的 shell 到剛才找出的位置
- chsh -s /usr/local/bin/git-shell git
- # 注意
- – 最後確保 /home/git/.ssh/authorized_keys 內的 key 是正確
- – 再測試在自機測試 clone 遠端的 repo,應該就不需要密碼了
- – 例如遠端目錄的樣子是: /home/git/work/core.git
- git clone git@example.com:work/core.git
– See more at: http://www.actkr.com/?p=1120#sthash.3P7oyu3U.dpuf