To use the openai-github-copilot
service, you need a GitHub Copilot-enabled access token. This is a string that starts with either ghu_
or gho_
.
This directory contains scripts that assist you in locating the access token on your system (if you've previously used the official Copilot plugin or CLI), or generating a new one.
Warning
You still need an active Copilot subscription.
For your convenience, we've listed command lines below that you can execute immediately, without the need to download any script explicitly.
Of course, you can also execute these scripts locally.
While the scripts are straightforward and you can review their source code yourself, their use is entirely optional. You can achieve the same results without using these third-party scripts:
-
If you have previously used Copilot in VSCode or JetBrains, you should check the
hosts.json
file, which is located at~/.config/github-copilot/hosts.json
(for Linux), or%LOCALAPPDATA%\github-copilot\hosts.json
(for Windows). -
If you have previously used Copilot through the github-copilot-cli, you should check a different file:
~/.copilot-cli-access-token
(for Linux), or%HOMEDRIVE%HOMEPATH%\.copilot-cli-access-token
(for Windows).If not, then follow next steps:
- Install it using
npm i -g @githubnext/github-copilot-cli
(you need Node.js for this). - Run
github-copilot-cli auth
and follow the instructions.
Ignore the "Failed to authenticate.." message, it's not relevant here. - Retrieve your token from
copilot-cli-access-token
, as described above.
- Install it using
Find existing Github Copilot access token
- Bash
curl -LsSf https://gitea.com/PublicAffairs/openai-github-copilot/raw/main/scripts/find_token.sh | sh
- Powershell
powershell -c "irm https://gitea.com/PublicAffairs/openai-github-copilot/raw/main/scripts/Find-Token.ps1 | iex"
Generate Github Copilot access token
- Bash
curl -LsSf https://gitea.com/PublicAffairs/openai-github-copilot/raw/main/scripts/get_copilot_token.sh | sh
- Python
curl -LsSf https://gitea.com/PublicAffairs/openai-github-copilot/raw/main/scripts/get_copilot_token.py | python
- Powershell
powershell -c "irm https://gitea.com/PublicAffairs/openai-github-copilot/raw/main/scripts/Get-CopilotToken.ps1 | iex"