# [GitHub] 無法 push 至 GitHub ###### tags: `GitHub` ## 問題:push 至 GitHub 時出現以下訊息 ```bash git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags origin refs/heads/main:refs/heads/main Pushing to https://github.com/帳號/repository-name.git remote: Write access to repository not granted. fatal: unable to access 'https://github.com/帳號/repository-name.git/': The requested URL returned error: 403 Completed with errors, see above ``` ## 原因 當初是採用 HTTPS Clone repository ## 解法 1. `cd 資料夾` 2. 輸入 `git remote -v`,會看到 ``` origin https://github.com/帳號/repository-name.git (fetch) origin https://github.com/帳號/repository-name.git (push) ``` 4. 輸入 `git remote set-url origin git@github.com:帳號/repository-name.git` ## 參考資料 * [Could not read/write from/to remote repository](https://stackoverflow.com/a/72258033 "Could not read/write from/to remote repository") --- :::info 建立日期:2023-02-10 更新日期:2023-02-10 :::