Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1968, #1027 - Fetch-> fatal: could not read Username #2481

Merged
merged 2 commits into from
Mar 10, 2023

Conversation

foxwoods369
Copy link

Description

Uses the core git fetch command instead of a command-line git fetch so VsCode will prompt the user for their username and password. Pull & push also use their corresponding core commands.

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

@d13 d13 self-assigned this Mar 10, 2023
@d13 d13 self-requested a review March 10, 2023 02:36
skylerdawson and others added 2 commits March 9, 2023 21:50
…Username

Uses the core git fetch command instead of a command-line
git fetch so VsCode will prompt the user for their username
and password. Pull & push also use their corresponding core commands.
@d13 d13 force-pushed the fix-fetch-issue-1027 branch from 8b2bd18 to 40b5fd3 Compare March 10, 2023 02:53
Copy link
Member

@d13 d13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing @foxwoods369! Looks good to me 🎉

@ShafinKhadem
Copy link
Contributor

@d13 This PR caused some regressions which I've tried fixing in #2588. Please take a look. Thanks.

ShafinKhadem added a commit to ShafinKhadem/vscode-gitlens that referenced this pull request Mar 21, 2023
ShafinKhadem added a commit to ShafinKhadem/vscode-gitlens that referenced this pull request Apr 7, 2023
@Weijiang-Xiong
Copy link

Weijiang-Xiong commented Jun 24, 2023

Hello, I'm now having the error again, same as #1027.

I'm sshing to an ubuntu 22.04 remote compute from an windows 10 PC, and I signed in to github in vscode. The builtin source control works fine, but the branch fetching in gitlens panel gives the following error. However, when I click the globe button to open remote branch, it also opens the correct branch in my browser.

The remote branch is set with https, if I swtich to ssh, the builtin source control doesn't work anymore, since I don't have my ssh code in github (but I think this is the reason for signing in with vscode).

Maybe I'm getting the fix wrong, but could you tell me how to get this PR? I've already updated to the latest gitlens extension. (V14.0.1 as I can see)

Here is the output by gitlens.

[2023-06-24 23:11:39.156] /home/admin/.vscode-server/extensions/eamodio.gitlens-14.0.1/dist/gitlens.js:1:296036
Error: Command failed: /usr/bin/git -c core.quotepath=false -c color.ui=false fetch origin engine:refs/remotes/origin/engine
fatal: could not read Username for 'https://github.com': No such device or address

Here is the version info from vscode.

Version: 1.79.2 (user setup)
Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06
Date: 2023-06-14T08:57:04.379Z
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19045

@axosoft-ramint
Copy link
Contributor

axosoft-ramint commented Jun 30, 2023

@Weijiang-Xiong I would like your help to test a potential fix to your issue.

Currently, when using a fetch without a branch specified, we use the built-in SCM's version of fetch. When a branch is specified for the fetch, we use our own, which is why you would be getting the error output there and not in other fetch cases.

We are trying to determine if this is because of the difference between the SCM's auth for git operations and our own.

In tomorrow's pre-release of GitLens, we've introduced an experimental option where we pull in some of the Git environment of the SCM into our own Git implementation.

We would like your help to test the branch fetch that is failing for you above by doing the following:

  1. Update to the Pre-release version of GitLens (the latest one with this potential fix releases tomorrow, roughly 7 hours from this post, so any time after that). You can switch to the Pre-release version of GitLens from its extension banner on the GitLens extension homepage (from the Extensions view).

image

  1. In your settings JSON, add the following line: "gitlens.experimental.nativeGit": true. You can modify by Command Palette command: Preferences: Open User Settings (JSON)

image

image

  1. Reload using the Developer: Reload Window` command from the Command Palette or just reopen VS Code or open a new window (so that the new setting you added takes effect).

image

  1. Try the branch fetch again, as you did above.
  2. Let me know if it works or if you get similar error output.

@Weijiang-Xiong
Copy link

Thank you @axosoft-ramint ! I switched to the pre-release, and added the setting as you said, and now I can refresh the branches without problem!

@axosoft-ramint
Copy link
Contributor

@Weijiang-Xiong Glad to hear it. Thank you! Will follow up with a few other users having the same issue to confirm, but it seems likely that the issue was indeed related to the difference between the auth used by built-in SCM git and GitLens' git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants