Using submit50 in VSCode - visual-studio-code

I'm doing CS50 AI ( a course from harvard on EdX) and as a result been using submit50 (the command we use to submit assignments) in VSCode via the Windows Subsystem for Linux. Until I updated my IDE to the April update, submit50 used to ask my GitHub username and password in the the terminal itself similar to CS50 IDE.
After the April Update, it redirected me to the GitHub website for authentication and ever since then, I've been getting an error and can't figure out how to fix this.
I've tried re-install VSCode and submit50, upgrading submit50 and none of this has helped.
The Error I'm getting
I deleted VSCode and Code from Appdata to try and delete all data but that did not help.
Git Asking for permission
Any help would be appreciated!

This is due to the new automatic GitHub authentication introduced in VSCode version 1.45.
The temporary fix for this is to disable Git: GitHub Authentication in your VSCode settings either via the settings UI, or by adding the following line to your settings.json:
"git.githubAuthentication": false,
When you try to run submit50 again, a popup prompt for your username and password will appear instead!
Alternatively, you can disable Git: Terminal Authentication in your VSCode settings either via the settings UI, or by adding the following line to your settings.json:
"git.terminalAuthentication": false,
Via this method, you'll get the login prompt for submit50 inside the terminal as per usual.

Related

github login and sync failure in updated vscode linux version

recently I installed a fresh version of the KDE neon user edition and I updated it and works fine.
I also installed the vscode Debian version and nothing is wrong.
but when I want to login with my GitHub account in vscode for configs sync it opens a firefox tab that I log in to my GitHub and authorizes the vscode and it succeeds and gets back to vscode and instead of signing in and syncing the configs it opens an empty unsaved file named something like this:
did-authenticate\?windowid\=1\&code\=6beea2fcb8a47e0ea49e\&state\=2efc5efd-9c68-4735-a4a0-fd690dd7aec0
in this path : "~/vscode:/vscode.GitHub-authentication"
and after a few seconds canceled notification appears.
I've installed vscode for Debian version 1.63.2 which people in this Github issue had the same problem in version 1.62.2 and they are saying that this problem is fixed for them in version 1.62.3.
I don't have this problem with the Microsoft account sign-in.
what am I missing?
Update:
for testing, I tried to install an extension for vscode and I pasted the URL with vscode protocol in a web browser like this (vscode:extension/GitHub.vscode-pull-request-github), and instead of opening the vscode extensions tab, it goes back to vscode and opens an empty file in the same directory ("~/vscode:/vscode.GitHub-authentication").
so this is vscodes fault that cant handle the vscode: URLs.
I found out what the problem is but I don't know how to fix it
for the record I've updated the vscode today to the 1.64.1 version and still have the problem.
enter image description here
First, you need to get the GitHub Pull Requests and Issues and GitHub extensions together. Then go to the section specified in the photo and give the details of the account and repository you are using. And then it will be fixed.
I ran into this issue myself and discovered that it's because the VS Code command-line application isn't designed to handle URLs, but local file paths. VS Code registers the vscode:// URL scheme with XDG using an appropriate *.desktop file and these URLs should be opened using the command-line program xdg-open. In Firefox, if you have not yet set a default application for vscode:// URLs, then it will ask you for a program to open it with, select /usr/bin/xdg-open. If you have already set it to a different default, you can change it as follows: go to the Menu -> Settings -> General -> Applications -> vscode -> Use other... -> Select /usr/bin/xdg-open as the program for vscode.
With the default for vscode:// URLs set to use xdg-open, then any future integration with VS Code should work naturally to open it as expected.

GitHub Copilot Commands not working and showing error

I have installed GitHub Copilot just for the sake of testing. However, none of the commands work.
For example if I try CTRL + Enter I get this error message:
command 'github.copilot.generate' not found
I am trying it with JS file.
I have latest Visual Studio Code and Copilot installed.
Click on the bell button on bottom right-corner of the Visual Studio Code Editor
Press 'Agree' button
Thats it!
I had already signed up for the Technical preview and also accepted the invite for the same. Even after being signed in to VS Code using the same account, I had this error. This solution worked for me:
Sign out of my account from the Accounts section of the left
sidebar on VS Code
Sign in again using the same account in which invite was received
NOTE: There is a thread on the official Copilot discussion board on this issue here.
I have access to Github Copilot as well but get the error:
command 'github.copilot.generate' not found
Tried reloading and reinstalling it as well through vscodes ui.
Went in and manually went through the process of completely deleting it explained here.
Afterward, I logged out of my Github account attempted to install Copilot then logged back in when the prompt was displayed, again no luck.
Tested running both CTRL+ENTER and Alt+\ , neither of them did anything.
After I tried:
Developer: Reload Window
But that didn't do anything.
Checked the discussion forums and they had a solution for:
command 'github.copilot.toggleCopilot' not found
Which was to simply uninstall then reinstall copilot then run CTRL+R (Developer: Reload Window), this too didn't work out.
There's a good chance that all you'd have to do is retrigger the authentication flow considering that the developer tools console reports that copilot is "missing an auth token" (but no one knows how to retrigger it).
In addition to the above, I tried running CTRL+SHIFT+P then ran "Open Copilot", which resulted in the error
Command 'Open Copilot' resulted in an error (command 'github.copilot.generate' not found)
From this discussion post on another forum with a similar issue, apparently, this is an issue with command registration.
This specific comment seemed most relevant
Uninstall Python extension (if you have pylance uninstall it first).
Close all instances of VS Code.
Go to,%USERPROFILE%/.vscode/extensions (on windows) or
~/.vscode/extensions on Linux/Mac.
Delete any folder with the name starting with ms-python.python*
Start VS Code, and install Python extension (also pylance if you
uninstalled it in step 1).
Of course, you'd have to apply this to Copilot so...
Uninstall Copilot
Close all instances of vscode
Go to, %USERPROFILE%/.vscode/extensions (on windows) or ~/.vscode/extensions on Linux/Mac.
Delete all instances of Copilot
Go to, %USERPROFILE%/AppData/Roaming/Code/CachedExtensionVSIXs
Delete all instances of Copilot
Start and install Copilot
This too didn't work.
If I were to guess this would be solvable via retriggering the authentication flow.
(1) Go to, %USERPROFILE%/AppData/Roaming/Code/CachedExtensionVSIXs
(2) Delete all files and reopen vsCode.
This happens when you have failed to authenticate Copilot with Visual Studio Code.
If you had a missed authentication flow the flow can be re-triggered by clicking the VSCode Notifications icon on the status bar and clicking on the Sign in to Github notification.
If you have lost the authentication flow notification from the notifications panel, re-installing the Copilot helps.
TIP: To make it easier to sign in, make sure you are already authenticated on github.com on the default browser.
You can open the extensions tab or press ctrl + shift + x to look at the copilot extension.
you may reload it if you have authenticated with your GitHub account before.
Step 1:
First you need to login with same Github account you use for copilot beta signup, in your default browser.
If you mistakenly did something wrong here, just uninstall the extension and reload it, and then repeat step 1.
I don't know how this ties in but maybe it will help.
I have several times gotten a page saying that Copilot installed but wasn't done yet, and that I could finish the process by pasting an auth code into the "sign on to Github" link found in the VSCode status bar.
No such sign-on link ever showed up in my status bar but the auth code looked like this:
vscode-insiders://vscode.github-authentication/did-authenticate?windowid=1&code=65....
but I have found no place I can run that where it produces the desired result. At best I end up back at the waitlist sign on page.
Just log out your github account and re-log-in it in VSCode
In OSX this worked:
On a previous try, I had logged in to the wrong GitHub account. Be sure to be logged in with the correct GitHub account in the browser. Delete the extension from VSCode. Then open the Keychain Access -app and delete GitHub keys from there. After that install the extension and now it gets the correct authorization.
I found that the reason was because my account never prompted me to allow the access as one of the top answers shows. It may have something to do with a firewall or other permissions (or bugs) on your machine. If you have access to another computer you can try to use Co-Pilot and see what happens. For me, everything worked on the second computer. Then you could compare and see what is different. In my case, it was my work's VPN that didn't allow. Once I disconnected from the VPN or tried another device, it worked fine.
Check if you behind a firewall or proxy
Have you got the copilot beta? If not, you cant use it!
Updating Github Copilot helped (for NVim + Vundle I did :BundleUpdate).

Vscode interfering with npm GitHub install

Today npm started to act up when I executed npm i <github repo> inside a VSCode terminal.
The action was interrupted by a VSCode popup window
"Image: The extension GitHub wants to sign in using GitHub."
I [Cancel]'ed that popup, but npm still hung.
This time two popups occurred in vscode asking me for username and password.Image: VSCode input dialogues for username and password
I [ESC][ESC]'ed out of those, but the same thing happened a second time.
I avoided that too by doing [Cancel][ESC][ESC] again.
Despite my actions to "ignore" the interruption, the GitHub library actually got installed (Hurray).
Retrying the same install in a terminal outside VSCode, did not show the same interruption.
Does anybody know how I can get rid of this annoying interference from VSCode?
It should be noted that there are no GitHub extension showing in the VSCode extension list.
Is there some internal GitHub extention in VSCode?
I already have perfectly good SSH-key credentials for GitHub that works well with npm outside VSCode. I do not see why I should spread my credentials to VSCode as well.
Regards,
Erik
VSCode 1.48.2,
Ubuntu 18.04.5 LTS
I had this problem too, and only found suggestion of setting
"github.gitAuthentication": false,
This stopped the first popup you describe, but I could still not suppress the second Git username and password dialog. I've found that to stop that, it is also necessary to set:
"git.terminalAuthentication": false,
Note: The integrated terminal will need to be exited/restarted for this to take effect.

GitHub clone to desktop uses TortoiseGit instead of GitHub Desktop

When i try to clone a repository to desktop the default app for cloning has suddenly became TortoiseGit instead of GitHub. Anyone with a fix?
The following fix is a permanent solution for this issue that also withstands TortoisGit-updates/repairs.
It adds GitHubDesktop's protocol-associations the way described in https://learn.microsoft.com/en-us/windows/win32/shell/default-programs.
Add to the registry (You can save this content as .reg file and double-click it to auto-import these keys into registry):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities\UrlAssociations]
"github-windows"="github-windows"
"x-github-client"="x-github-client"
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"GitHubDesktop"="Software\\GitHubDesktop\\Capabilities"
Reboot or on a windows-server sign-out and log-in.
The next time a project is cloned from github, a message-box popped-up asking to pick an app.
GitHubDesktop will now also be available in the Windows settings: Choose default apps by protocol. So it can be recovered with Windows settings, if TortoisGit (or another app) was chosen as default handler for GitHub-clone.
I also opened a new error at GitHubDesktop-development: https://github.com/desktop/desktop/issues/8258
There was a bug in 2.6.0 which made TortoiseGit the default if the github handler was enabled on installation.
To fix this, go to the default programs settings in Windows, open the file-type associations dialog and set github-windows and x-github-client back to the official github client. Maybe you have to update to TortoiseGit 2.7.0 first.
cf. https://www.thewindowsclub.com/change-file-associations-windows
You could try whether the hard way works: (Store this as a .reg file and import it, you need to madjust the paths)
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\github-windows]
[HKEY_CLASSES_ROOT\github-windows]
"URL Protocol"=""
#="URL:github-windows"
[HKEY_CLASSES_ROOT\github-windows\shell\open\command]
#="\"C:\\Users\\USERNAME\\AppData\\Local\\GitHubDesktop\\app-1.4.2\\GitHubDesktop.exe\" --protocol-launcher \"%1\""
[-HKEY_CLASSES_ROOT\x-github-client]
[HKEY_CLASSES_ROOT\x-github-client]
"URL Protocol"=""
#="URL:x-github-client"
[HKEY_CLASSES_ROOT\x-github-client\shell\open\command]
#="\"C:\\Users\\USERNAME\\AppData\\Local\\GitHubDesktop\\app-1.4.2\\GitHubDesktop.exe\" --protocol-launcher \"%1\""
change windows registry is not working.
I have met the same problem and the registry is all right,but github desktop wont come out.
As a software developer,I used url protocol once.I cannt understand why Windows setting is not related to the ROOT registry . I would appreciate a comment.
here is how i solve the problem:
After uninstall tortoise and reinstall github. Chrome works fine.
When you install tortoise,be careful with this setting:
but even if you unchecked this,x-github-client is registed to tortoisegit client again.
You can check it in your windows setting of default apps - choose default apps by protocal.
So i think this is a bug for tortisegit.
I use tortoisegit 2.7.0 and win10 1809.
If you really want github desktop to popup , you should not install tortoisegit
This is based on tobias.loew answer:
If you don't have this line at the start:
Windows Registry Editor Version 5.00
Script won't compile
Create github.reg file:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities\UrlAssociations]
"github-windows"="github-windows"
"x-github-client"="x-github-client"
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"GitHubDesktop"="Software\\GitHubDesktop\\Capabilities"
Put this in a file called github.reg and then double click it.

How to disable graphic login on Github, when using terminal?

I have an issue, that while using Github on terminal, I get graphical prompts for login. I would like to disable the graphical login.
When I am trying to push files to a Github repository, while using Terminal, I get a graphical popup login window (and afterwards password one).
If I press cancel in either of the windows, it gives output shown bellow and allows me to login directly from the terminal (the way I would like to).
error: unable to read askpass response from '/usr/libexec/openssh/gnome-ssh-askpass'
Password for 'https://Username#github.com':
I am using URXVT terminal emulator on Fedora with Gnome, but the same occurs while using Gnome-Terminal.
I just came across this same issue of the unwanted GUI login prompt. Bad form by GitHub for not providing an option to disable it or even telling you about the hook they added.
To disable it, open your system git config file:
git config --system --edit
Then delete the line:
helper = manager
That line is to enable a credential helper for git.