VS Code 快捷鍵
Ctrl + Shift + P(命令面板)
Win + ↑(開發環境最大化)
Ctrl + `(開啟終端機)
開發 python
1. Remote-SSH 連 Ubuntu
2. mkdir my_python_project; cd my_python_project
3. python3 -m venv venv
4. source venv/bin/activate
5. Ctrl + Shift + P(命令面板) 輸入 Python: Select Interpreter, 選擇 ./venv/bin/python
6. 開始寫 main.py
7. pip install request
8. pip freeze > requirements.txt
使用 uv 開發 python
1. Ctrl + `(開啟終端機)
2a. mkdir my_python_project; cd my_python_project
2b. uv init my_python_project; cd my_python_project
3. uv venv
4. source .venv/bin/activate
5. Ctrl + Shift + P(命令面板) 輸入 Python: Select Interpreter, 選擇 ./venv/bin/python
6. 開始寫 main.py
7. uv add requests
再加上 git
1. git init
2. cat > .gitignore <<EOS
.venv/
__pycache__/
*.pyc
.env
EOS
3. git add .
4. git commit -m "Initial commit"
5. 在 GitHub 建立 Repository
5a. 打開 GitHub 網站
5b. 點 New repository
5c. Repository name:和資料夾同名(建議)
5d. 不要勾 README / .gitignore / license
5e. 建立 Repository
6. 從 VS Code / Ubuntu 推到 GitHub
git branch -M master
git remote add origin https://github.com/你的帳號/專案名.git
git push -u origin master
上述命令執行後,注意視窗上方要輸入密碼
7. 改程式後
git add .
git commit -m "說明你改了什麼"
git push
8. 在別的地方更新過
git pull
9. VS Code 介面操作
VS Code 左邊的 Source Control
Stage(+)
Commit
Push / Pull
10a. 查詢本地專案設定
git config user.name
git config user.email
10b. 查全域設定
git config --global user.name
git config --global user.email
10c. 設定 Git 身分
git config --global user.name "你的名字"
git config --global user.email "你的 GitHub Email"
11. 查看所有遠端
git remote -v
12. 查看某個 remote 詳細資訊
git remote show origin
13. 常見遠端名稱
origin 原始遠端,通常是主 GitHub repository
upstream 當你 fork 別人的 repo,用來指原始 repo
backup 備份用遠端,例如 GitLab、私有伺服器
沒有留言:
張貼留言