個人開發環境配置腳本,用於快速配置新環境。
- Ubuntu
-
檢查是否已有 SSH 金鑰:
ls -la ~/.ssh -
如果沒有,生成新的 ED25519 金鑰:
ssh-keygen -t ed25519 -C "your_email@example.com" -
設置正確的權限:
chmod 700 ~/.ssh chmod 600 ~/.ssh/id_ed25519 chmod 644 ~/.ssh/id_ed25519.pub
-
創建或編輯 SSH 配置文件:
vim ~/.ssh/config添加以下內容:
Host github.com HostName github.com User git IdentityFile ~/.ssh/id_ed25519 IdentitiesOnly yes設置配置文件權限:
chmod 644 ~/.ssh/config -
將公鑰添加到 GitHub:
# 複製公鑰內容 cat ~/.ssh/id_ed25519.pub
然後在 GitHub 設置中添加 SSH key
-
測試 SSH 連接:
ssh -T git@github.com
-
安裝 git:
sudo apt update sudo apt install git
-
克隆倉庫:
git clone git@github.com:YuFireWhisper/setup-env.git -b ubuntu
-
進入目錄:
cd setup-env -
給腳本執行權限:
chmod +x setup.sh
-
運行腳本:
sudo ./setup.sh
- 基本開發工具(git, curl, wget, tree)
- Python 環境
- Node.js
- C/C++ 開發環境(gcc, g++, clangd)
- Neovim 配置
- 運行腳本前必須完成 SSH 配置
- 需要 sudo 權限運行腳本
- 腳本會自動配置 Git 使用者信息