-
-
Save sarimarton/55779cf95028860ea2126e61a6b377d0 to your computer and use it in GitHub Desktop.
# [2023-05-25] Added Copilot Chat, and VSCode Insiders | |
# [2023-05-20] Add VSCode Insiders variant | |
# [2023-02-22] Added Copilot Labs | |
# Fix Github Co-pilot self-signed cert problem | |
# See: https://github.com/orgs/community/discussions/8866#discussioncomment-3517831 | |
# Note | |
# | |
# To make Github Copilot/Nightly/Labs/Chat work, you might need additional | |
# steps. | |
# ---------------------------------------------- | |
# - The bash script is solid. Keep the fixing command run on shell start. | |
# - Sign out of github from vscode, lower left corner. Ref: | |
# https://docs.github.com/en/copilot/troubleshooting-github-copilot/troubleshooting-common-issues-with-github-copilot#error-github-copilot-could-not-connect-to-server-extension-activation-failed | |
# - Reload window, sign back in, make sure you're using the Chrome window with | |
# the right profile (with which you're logged in to the right account), reload | |
# window | |
# - Check VSCode Output pane | |
# - if EAI_AGAIN error happens, in particular under WSL, this worked: | |
# - sudo sh -c "echo nameserver 8.8.8.8 > /etc/resolv.conf" | |
# - Ref: https://github.com/community/community/discussions/19499#discussioncomment-5026421 | |
# - As for Labs/Chat, check their webpage, there might be a waiting list, or | |
# terms to accept before you get access. The error message in the Output pane | |
# should give you a hint about it. | |
fix_github_copilot() { | |
local silent_mode=$1 | |
apply_patch() { | |
local vscode_dir=$1 | |
local regex_pattern=$2 | |
local extension_name=$3 | |
local extensions_path="$HOME/${vscode_dir}/extensions" | |
local copilot_dir=$(ls "${extensions_path}" | grep -E "${regex_pattern}" | sort -V | tail -n1) || return | |
local extension_filepath="${extensions_path}/${copilot_dir}/dist/extension.js" | |
if [[ -f "$extension_filepath" ]]; then | |
if [[ $silent_mode != 'silent' ]]; then | |
echo "Found $extension_name extension, applying 'rejectUnauthorized' patches to '$extension_filepath'" | |
fi | |
perl -pi -e 's/,rejectUnauthorized:[a-z]}(?!})/,rejectUnauthorized:false}/g' ${extension_filepath} || echo "Perl patch failed" | |
sed -i.bak 's/d={...l,/d={...l,rejectUnauthorized:false,/g' ${extension_filepath} || echo "Sed patch failed" | |
fi | |
} | |
perform_fix() { | |
if [[ -d "$HOME/$1" ]]; then | |
apply_patch "$1" "github.copilot-[0-9].*" "Copilot" | |
apply_patch "$1" "github.copilot-nightly-[0-9].*" "Copilot Nightly" | |
apply_patch "$1" "github.copilot-labs-[0-9].*" "Copilot Labs" | |
apply_patch "$1" "github.copilot-chat-[0-9].*" "Copilot Chat" | |
fi | |
} | |
perform_fix ".vscode" | |
perform_fix ".vscode-server" | |
perform_fix ".vscode-insiders" | |
perform_fix ".vscode-server-insiders" | |
unset -f apply_patch | |
unset -f perform_fix | |
} | |
fix_github_copilot silent |
Thank you! Works like a Charm for remote Editors!
Thanks! I tried so many things, this is the only thing that worked for me!!!
although it didn't work for GitHub.copilot-labs....
@shlomo20 I have extra notes on copilot labs on my company laptop, I just paste it here as is:
Make Github Copilot/Nightly/Labs/Chat work
- Ref: https://gist.github.com/sarimarton/55779cf95028860ea2126e61a6b377d0
- the bash script is solid. Install the extensions (both copilot and labs) and patch them. Keep the fixing command run on shell start.
- sign out of github from vscode, lower left corner
ref: https://docs.github.com/en/copilot/troubleshooting-github-copilot/troubleshooting-common-issues-with-github-copilot#error-github-copilot-could-not-connect-to-server-extension-activation-failed - reload window, sign back in, but make sure you're using the Chrome window with the right profile (with which you're logged in to the right account), reload window
- check Output pane
- if EAI_AGAIN error happens, in particular under WSL, this worked:
- sudo sh -c "echo nameserver 8.8.8.8 > /etc/resolv.conf"
- Ref: community/community#19499 (comment)
- As for Labs, check their webpage, there might be a waiting list, or terms to accept before you get access. The error message in the Output pane should give you a hint about it.
Thanks, It work for me
Thank you so much!
Does this work with Github Copilot Chat?
I answered my own question by adding this line to the script, and following the direction per @shlomo20 above. Thanks guys!
patch_ext "$1" "github.copilot-chat-[0-9].*" "Copilot Chat"
Thanks @jtele2, I've added the line.
Thank you @sarimarton, and I've also mentioned your gist here: microsoft/vscode-copilot-release#136
It would appear they have patched this out now.
The proxy connection couldn't be established due to an untrusted self-signed certificate, or your Copilot license might not support their use.
@selabie68 What do you mean - it is no longer a work-around anymore?
thanks you so much <3
Thanks for this!