Composer Github OAuth Required


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 執行 composer update 時出現
Could not fetch https://api.github.com/repos/XX, enter your GitHub credentials to go over the API rate limit
The credentials will be swapped for an OAuth token stored in /home/user/.composer/config.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications

# 取得 token (如沒有開啟兩步認證)
curl -u 'user' -d '{"note":"GitHub OAuth for composer"}' https://api.github.com/authorizations

# 取得 toekn (如果已經開啟兩步認證)
1. 登入 Github 頁面
2. 前往 https://github.com/settings/applications
3. Personal Access Tokens > Create new token
4. 建立後取得那串字

# 建立 ./composer/config.json
vim /home/user/.composer/config.json

{
"config":{
"github-oauth":{
"github.com":"YOUR TOKEN"
}
}
}

# 再嘗試
composer update