# Git Setup Instructions ## Repository Information - **Gitea URL**: https://gitea.theaken.com/ - **Username**: donald - **Token**: 9e0a888d1a25bde9cf2ad5dff2bb7ee6d68d6ff0 ## Step 1: Create Repository on Gitea 請先在 Gitea 上建立新的 repository: 1. 訪問 https://gitea.theaken.com/ 2. 登入帳號 (donald) 3. 點擊右上角 "+" -> "New Repository" 4. 填寫: - **Repository name**: `5why-analyzer` - **Description**: `5 Why Root Cause Analysis Tool with Ollama API Integration` - **Visibility**: Private (或根據需求選擇) - **Initialize**: 不要勾選任何選項(我們已經有 local repository) 5. 點擊 "Create Repository" ## Step 2: Add Remote and Push 建立 repository 後,執行以下指令: ```bash # 進入專案目錄 cd "c:\Users\91223\Downloads\5why" # 添加 remote(使用 Token 認證) git remote add origin https://9e0a888d1a25bde9cf2ad5dff2bb7ee6d68d6ff0@gitea.theaken.com/donald/5why-analyzer.git # 或使用 SSH(如果有設定 SSH key) # git remote add origin git@gitea.theaken.com:donald/5why-analyzer.git # 推送到 Gitea git push -u origin master # 或如果主分支叫 main # git branch -M main # git push -u origin main ``` ## Step 3: Verify 檢查 repository 是否成功推送: ```bash git remote -v git status ``` 訪問 https://gitea.theaken.com/donald/5why-analyzer 查看 repository ## Alternative: Using Gitea API 如果您想要用 API 自動建立 repository: ```bash curl -X POST "https://gitea.theaken.com/api/v1/user/repos" \ -H "Authorization: token 9e0a888d1a25bde9cf2ad5dff2bb7ee6d68d6ff0" \ -H "Content-Type: application/json" \ -d '{ "name": "5why-analyzer", "description": "5 Why Root Cause Analysis Tool with Ollama API Integration", "private": true, "auto_init": false }' ``` 然後執行: ```bash cd "c:\Users\91223\Downloads\5why" git remote add origin https://9e0a888d1a25bde9cf2ad5dff2bb7ee6d68d6ff0@gitea.theaken.com/donald/5why-analyzer.git git push -u origin master ``` ## Troubleshooting ### Error: remote origin already exists ```bash git remote remove origin git remote add origin https://9e0a888d1a25bde9cf2ad5dff2bb7ee6d68d6ff0@gitea.theaken.com/donald/5why-analyzer.git ``` ### Error: Authentication failed 確認 Token 是否正確,或嘗試用使用者名稱密碼: ```bash git remote set-url origin https://donald:!QAZ2wsx@gitea.theaken.com/donald/5why-analyzer.git ``` ### Error: SSL certificate problem ```bash git config --global http.sslVerify false ``` --- **Note**: Token 已在 `.env` 檔案中,記得不要 commit `.env` 到 repository!