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

Built-in GitHub extension still partly using signed out account #158733

Closed
dgxo opened this issue Aug 22, 2022 · 14 comments
Closed

Built-in GitHub extension still partly using signed out account #158733

dgxo opened this issue Aug 22, 2022 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug github Github extension github-authentication Issues with the GitHub Authentication extension info-needed Issue requires more information from poster

Comments

@dgxo
Copy link

dgxo commented Aug 22, 2022

Type: Bug

after initializing a repo using the built-in extension then trying to publish it to github it creates a repository but "doesn't have permission to commit" to it. Only one account properly signed in, but the output shows it's trying to use another old account as well.

1. Create a folder, with at least one file, and init a git repo using the GitHub tab
2. Make a first commit, then publish the branch.
3. Use a public/private repository with any name.
4. Error shows up saying "You don't have permissions to push to ... on GitHub. Would you like to create a fork and push to it instead?".
5. Trying to fork it doesn't work because nothing has been pushed to the GitHub repository.
6. If you do add a file manually on the website and try to fork, the exact same error appears.

VS Code is trying to use another account that was previously signed out to perform certain actions, such as committing, but using the correct account in other cases.

Screenshot from GitHub output in VSC

Error

Video showing issue

Also in both of the logs in the .git folder include the old account name.
git/logs/HEAD also wasn't sure if that was sensitive info probs not
git/logs/refs/heads/master also wasn't sure if that was sensitive info probs not

VS Code version: Code 1.70.2 (Universal) (e4503b3, 2022-08-16T05:36:37.829Z)
OS version: Darwin x64 20.6.0 (MacOS)
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz (8 x 2300)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 2
Memory (System) 16.00GB (5.15GB free)
Process Argv --crash-reporter-id 379f339a-b1cd-4fa7-9f8d-63d104fd2a8d
Screen Reader no
VM 0%
Extensions (46)
Extension Author (truncated) Version
html-snippets abu 0.2.1
Bookmarks ale 13.3.1
project-manager ale 12.6.1
Sk-VSC ayh 2.6.3
markdown-preview-github-styles bie 1.0.1
gitlens eam 12.1.2
vscode-html-css ecm 1.13.1
EditorConfig Edi 0.16.4
copilot Git 1.42.6544
go gol 0.35.2
kite kit 0.147.0
vscord Leo 4.5.0
mcjson Lev 0.4.1
vscode-JS-CSS-HTML-formatter lon 0.2.3
vsls-whiteboard los 0.0.12
prettify-json moh 0.0.3
python ms- 2022.12.1
vscode-pylance ms- 2022.8.30
jupyter ms- 2022.7.1102252217
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.9
remote-ssh ms- 0.84.0
remote-ssh-edit ms- 0.80.0
vsliveshare ms- 1.0.5690
indent-rainbow ode 8.3.1
minecraft-essentials-extension-pack pah 1.0.1
fabric8-analytics red 0.3.6
java red 1.9.0
vscode-checkstyle she 1.4.1
html5-boilerplate sid 1.1.1
datapack-language-server SPG 3.3.36
mcscript Ste 0.0.3
code-spell-checker str 2.6.0
html-preview-vscode tht 0.2.5
vscodeintellicode Vis 1.2.22
vscode-java-debug vsc 0.43.0
vscode-java-dependency vsc 0.21.0
vscode-java-pack vsc 0.25.0
vscode-java-test vsc 0.36.0
vscode-maven vsc 0.37.0
vscode-icons vsc 11.15.0
gistfs vsl 0.4.1
vscode-wakatime Wak 19.0.1
five-server yan 0.1.5
html-css-class-completion Zig 1.20.0
minecraft-lang-colorizer zz5 1.0.0

(2 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes516:30244333
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
wslgetstarted:30449410
cppdebug:30492333
pylanb8912:30545647
vsclangdf:30486550
c4g48928:30535728
hb751961:30543456
dsvsc012:30540252
azure-dev_surveyone:30548225

@gjsjohnmurray
Copy link
Contributor

Does the menu of the Accounts (person) icon at the bottom of the activity bar show that you are logged in on GitHub?

@dgxo
Copy link
Author

dgxo commented Aug 22, 2022

Does the menu of the Accounts (person) icon at the bottom of the activity bar show that you are logged in on GitHub?

Yes it does, also adding a video showing the issue.

@dgxo dgxo changed the title Cannot publish to GitHub Built-in GitHub extension still partly using signed out account Aug 22, 2022
@dgxo
Copy link
Author

dgxo commented Oct 30, 2022

Still having this issue, and it means I can't do anything to do with Github on VS Code.

@lszomoru lszomoru added github Github extension bug Issue identified by VS Code Team member as probable bug labels Oct 31, 2022
@fg-j
Copy link

fg-j commented Dec 22, 2022

I think I'm seeing the same thing with VScode within Github Codespaces :-/

@wykopx
Copy link

wykopx commented Apr 7, 2023

Having the same issue:

  • logged out from one profile
  • logged in to second profile
  • commit and push gives an error:

VS Code 1.77.1
image

Apparently VS Code is not using
GLOBAL git credentials
git config --list --global

not either LOCAL (for specific Git repo) - which it SHOULD
git config --list --local

when interacting with remote repository

VS CODE is using Windows Credential Manager
where you can find this little entry:

image

There is only ONE GitHub authentication and THIS is what VS CODE is using.

If you want to pull & push repositories as another user you have to DELETE this entry in Windows Credential Manager, authenticate using VS Code or git command line.

Than you can push as a new user.
That way previous account is no longer working and you will get one of two errors:

  1. When you are trying to push to public repository you don't have write-access:
    You don't have permissions to push to 'xxx' on GitHub. Would you like to create a fork and push to it instead?

or:
2. When you are trying to interact (push or pull) to a private repository:
remote: Repository not found. fatal: repository 'xxx' not found*

In both cases you need to again remove credentials in Credentials Manager and authenticate once again.

@dgxo
Copy link
Author

dgxo commented Apr 7, 2023

So when you sign into a new account it presumably changes Credential Manager but not the git config, though likely changes both on the first sign in? Could be an issue with overwriting the git config or signing in after setup runs different code.
I can't check right now but what was in the credential above the highlighted one? That could be used by VS Code too, or possibly some extension

@wykopx
Copy link

wykopx commented Apr 8, 2023

So when you sign into a new account it presumably changes Credential Manager but not the git config, though likely changes both on the first sign in?

No. Signing in / signing out in VS Code doesn't change Credential Manager entries at all.
You are always authenticated as user in Credentials Manager entry from my screenshot. There is no other way than removing that entry.

VS Code only ADDS entry to Credential Manager - if there is no authenticated user there.
VS Code can't change it.
VS Code can't delete it.

what was in the credential above the highlighted one? That could be used by VS Code too

Yes, those are some VS Code entries - don't have the "username" credentials.

image

@lszomoru
Copy link
Member

@TylerLeonhardt, could you please chime in on this one? Thanks!

@lszomoru lszomoru added the github-authentication Issues with the GitHub Authentication extension label Dec 12, 2023
@TylerLeonhardt
Copy link
Member

@dgxo where is this jeffthejeffthejeff account that is getting used signed in? Is it signed in to VS Code - do you see it in the Account menu?

The git:https://github.com I don't think is VS Code... maybe it's GCM?

We only support logging in to a single GitHub account in VS Code (for now) so whatever that account is signed in to should get used for the push... maybe that's the issue that needs to be addressed @lszomoru.

@dgxo
Copy link
Author

dgxo commented Dec 12, 2023

In the account menu and everywhere I can look shows my usual account (dgxo), the old account does only seem to be used in Git. Considering VSCode includes its own Git executable (afaik), it looks like GCM isn’t updated (or fails to update) when logging out of the current user or into another one. When I get back to my PC I’ll test whether my globally installed Git uses this user as well. (plus if I still have this issue, haven’t used the GitHub integration since). I’ll also see if I can reproduce this on my laptop with a new install of Windows and VS Code at some point.

@lszomoru
Copy link
Member

@dgxo, VS Code does not ship it's own version of git.exe, but leverages the one that is installed on the machine, or remote machine (remote development scenarios). VS Code hooks into the git authentication pipeline, at the end making sure that VS Code only gets involved if there are no other authentication mechanism configured by the user (ex: Git Credential Manager).

Do you have Git Credential Manager installed? Could you uninstall it and try without it? Thanks!

@lszomoru lszomoru added the info-needed Issue requires more information from poster label Dec 13, 2023
@vscodenpa
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
@spencerthayer
Copy link

What this fixed cause I am still getting this problem.

@C3ntraX
Copy link

C3ntraX commented Mar 13, 2024

Have the same problem

@microsoft microsoft locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug github Github extension github-authentication Issues with the GitHub Authentication extension info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

10 participants