# Vite 上傳 GitHub Pages 流程 ### 注意事項 圖片路徑位置 \ 頁面連結只需寫 href="index.html" ### 上傳步驟 >1. GitHub 創建一個 New Repository >2. 修改"vite.config.js"裡的"base: Repository名稱"  >3. `git init` >4. `git add .` >5. `git commit -m "first commit"` >6. `git branch -M main` >7. `git remote add origin https://github.com/jacksnipe0410/Repository名稱.git`  >8. `git remote`(測試有無連結成功) >9. `git push -u origin main` >10. `npm run deploy` 進行自動化部署網頁 ### 更新上傳 >1. `git add .` >2. `git commit -m "first commit"` >3. `git push` ### 更改資料庫位置 `git remote -v` 檢查目前的遠端設定 :::info 會列出當前的所有遠端倉庫。通常你會看到類似以下輸出: ``` origin https://github.com/yourusername/your-repo.git (fetch) origin https://github.com/yourusername/your-repo.git (push) ``` ::: ##### 更新或替換遠端 URL ``` git remote set-url origin https://github.com/yourusername/new-repo.git ``` ##### 刪除並重新添加遠端 ``` git remote remove origin git remote add origin https://github.com/yourusername/your-repo.git ``` :::warning 添加另一個遠端 `git remote add upstream https://github.com/yourusername/your-new-repo.git` 命令同時推送到不同的遠端倉庫 `git push upstream main` ::: ## 常見錯誤訊息 #### 「error:emote origin already exists」 資料已存在 #### 「remote: Repository not found.」找不到資料庫 資料來源:https://www.dotblogs.com.tw/CYLcode/2020/06/15/103014 如果確認git位置沒有問題(步驟8有回應:origin),但執行pull/push還是失敗並出現此錯誤訊息 >表示你當前remote的repository權限,跟你要pull/push的git位置權限不一致 >(GitHub帳密連結斷開) 解決方法: 重新設定Credential ``` git credential-manager uninstall git credential-manager install ``` 之後再重新 pull/ push即可
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up