# 如何解決 GitHub 認證失敗問題 - 使用 SourceTree

> remote: Support for password authentication was removed on August 13, 2021. remote: Please see [https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls) for information on currently recommended modes of authentication.

主要是使用 SourceTree 時到了認證失敗問題。因為 GitHub 自 2021 年 8 月 13 日起不再支持密碼認證，取而代之使用更安全的認證方式，例如個人訪問令牌（Personal Access Tokens, PATs）或SSH密鑰。以下是解決步驟：

* 點擊右上角的頭像，選擇「Settings &gt; Developer settings &gt; Personal access tokens &gt; Generate new token」。
    
* 回去 source Tree &gt; 專案 &gt; Settings(右上角) &gt; Remotes 正常會看到自己的專案，可能有 `origin` `upstream` path: [`https://github.com/username/repo.git`](https://github.com/username/repo.git)
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708308174922/4343993a-3c52-4546-a978-c03fb8f32cc5.png align="center")

* 點選 `Edit` 用剛剛取得的 token ，修改成以下
    
* `https://<your_token>@github.com/username/repo.git`
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1708308195460/a39adfef-2ae7-485a-9c55-58f486cd7026.png align="center")
