FreeBSD Git 安裝筆記 (2)


這篇主要是修正之前那篇 FreeBSD install Git and GitWeb 記錄的問題
解決了某些輸入密碼和 git shell 不能用的情況

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 切到 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 [email protected]:work/core.git