copilot login
This commit is contained in:
@@ -299,7 +299,7 @@ if ($nodeVer -match "v\d+") {
|
||||
Write-Info "安装 WSL2 Node.js LTS (via nvm)..."
|
||||
$installNodeCmd = @'
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get install -y -qq curl ca-certificates 2>/dev/null
|
||||
sudo apt-get install -y -qq curl ca-certificates wslu 2>/dev/null
|
||||
# 安装 nvm
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
if [ ! -d "$NVM_DIR" ]; then
|
||||
@@ -388,7 +388,7 @@ if ($ghVer -notmatch "MISSING") {
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo mkdir -p -m 755 /etc/apt/keyrings
|
||||
if [ ! -f /etc/apt/keyrings/githubcli-archive-keyring.gpg ]; then
|
||||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
||||
curl -fsSL --connect-timeout 20 --max-time 30 https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
||||
| sudo dd of=/etc/apt/keyrings/githubcli-archive-keyring.gpg status=none
|
||||
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
||||
fi
|
||||
@@ -396,15 +396,23 @@ if [ ! -f /etc/apt/sources.list.d/github-cli.list ]; then
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
|
||||
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||
fi
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq gh
|
||||
gh --version | head -1
|
||||
if sudo apt-get update -qq -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 2>/dev/null && \
|
||||
sudo apt-get install -y -qq -o Acquire::http::Timeout=30 gh 2>/dev/null; then
|
||||
echo GH_INSTALL_OK
|
||||
else
|
||||
echo GH_INSTALL_FAIL
|
||||
fi
|
||||
true
|
||||
'@
|
||||
Invoke-WSL $installGhCmd
|
||||
$ghInstallResult = Invoke-WSL $installGhCmd -IgnoreError
|
||||
$ghVer = Invoke-WSL "gh --version 2>/dev/null | head -1 || echo MISSING" -IgnoreError
|
||||
if ($ghInstallResult -match "GH_INSTALL_FAIL" -or $ghVer -match "MISSING") {
|
||||
Write-Warn "GitHub CLI 安装失败(网络超时),跳过;后续可手动安装:wsl -d Ubuntu -- sudo apt install gh"
|
||||
$ghVer = "MISSING"
|
||||
} else {
|
||||
Write-OK "GitHub CLI 安装完成: $($ghVer.Trim())"
|
||||
}
|
||||
}
|
||||
|
||||
if ($ghCopilotInstalled.Trim() -eq "0") {
|
||||
Write-OK "GitHub Copilot CLI 扩展已安装 (WSL2 原生)"
|
||||
|
||||
@@ -100,7 +100,7 @@ export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq \
|
||||
curl wget git build-essential pkg-config libssl-dev \
|
||||
ca-certificates gnupg lsb-release unzip python3
|
||||
ca-certificates gnupg lsb-release unzip python3 wslu
|
||||
log "系统依赖安装完成"
|
||||
|
||||
# ──────────────────────────────────────────────────────────────
|
||||
@@ -144,7 +144,7 @@ else
|
||||
log "安装 GitHub CLI..."
|
||||
sudo mkdir -p -m 755 /etc/apt/keyrings
|
||||
if [ ! -f /etc/apt/keyrings/githubcli-archive-keyring.gpg ]; then
|
||||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
||||
curl -fsSL --connect-timeout 20 --max-time 30 https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
||||
| sudo dd of=/etc/apt/keyrings/githubcli-archive-keyring.gpg status=none
|
||||
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
|
||||
fi
|
||||
@@ -152,9 +152,12 @@ else
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
|
||||
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||
fi
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq gh
|
||||
if sudo apt-get update -qq -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 2>/dev/null && \
|
||||
sudo apt-get install -y -qq -o Acquire::http::Timeout=30 gh 2>/dev/null; then
|
||||
log "GitHub CLI 安装完成: $(gh --version 2>/dev/null | head -1)"
|
||||
else
|
||||
warn "GitHub CLI 安装失败(网络超时),跳过;后续可手动安装:sudo apt install gh"
|
||||
fi
|
||||
fi
|
||||
|
||||
if gh extension list 2>/dev/null | grep -q 'github/gh-copilot'; then
|
||||
|
||||
Reference in New Issue
Block a user