2026年11月30日 星期一

解決 Git Bash 按 Tab 畫面閃爍(關閉 Visual Bell)

升級新版 Git for Windows 後,在 Git Bash 按 Tab 鍵無法補全時,視窗預設會閃一下白光(Visual Bell)。可透過修改 Readline 設定檔徹底關閉此行為。


解決步驟

編輯 ~/.inputrc,若該檔案不存在則自行建立,然後貼上以下內容:

$include /etc/inputrc
set bell-style none
說明:一旦家目錄存在 ~/.inputrc,Readline 就會停止讀取全域的 /etc/inputrc。第一行的 $include 用於引入系統預設按鍵綁定,避免 Home、End、Delete 鍵失效。

存檔後,執行以下指令立即重新載入設定(或直接重開終端機):

bind -f ~/.inputrc

驗證

  1. 在空白命令列連續按兩下 Tab 鍵,畫面不再閃爍。
  2. 輸入任意指令後測試 Home、End、Delete 鍵,確認游標移動與刪除功能正常。

2026年5月12日 星期二

在 Rancher Desktop(moby)設定 insecure registry

在 Rancher Desktop(moby)設定 insecure registry

最近在本機使用 Rancher Desktop pull 私有 registry image 時遇到:

http: server gave HTTP response to HTTPS client

原因是 registry 只有 HTTP,但 Docker 預設會用 HTTPS 連線。

我的環境是:

  • Rancher Desktop
  • Container Engine 選 dockerd (moby)

這種情況下,可以透過 provisioning script 自動寫入 daemon.json。


設定方式

建立以下目錄:

C:\Users\matt\AppData\Local\rancher-desktop\provisioning

新增檔案:

insecure-registry.start

內容:

#!/bin/sh
cat > /etc/docker/daemon.json <<EOF
{
"insecure-registries": ["your-registry:25000"]
}
EOF

很重要:檔案要用 LF

這個 .start shell script 一定要是:

LF

不能是:

CRLF

不然 provisioning script 可能無法正常執行。

如果你用 Visual Studio Code:

右下角可以切換:

CRLF → LF

重新啟動 Rancher Desktop

存檔後:

  1. 完全關閉 Rancher Desktop
  2. 重新開啟
  3. 等待 container engine 啟動完成

驗證設定

執行:

docker info | grep -A5 "Insecure"

看到類似:

Insecure Registries:
your-registry:25000
::1/128
127.0.0.0/8
Live Restore Enabled: false
Firewall Backend: iptables

代表設定成功。

之後就可以正常:

docker pull your-registry:25000/your-image

不用再遇到 HTTPS/HTTP mismatch 問題。