vscode-pull-request-github: Unable to Access Enterprise Git Pull Requests

❯ git remote --v
origin	git@github3.abcd-comp.com:myuser/some-repo.git (fetch)
origin	git@github3.abcd-comp.com:myuser/some-repo.git (push)
origin-https	https://github3.abcd-comp.com/my-org/some-repo.git (fetch)
origin-https	https://github3.abcd-comp.com/my-org/some-repo.git (push)
upstream	git@github3.abcd-comp.com:my-org/some-repo.git (fetch)
upstream	git@github3.abcd-comp.com:my-org/some-repo.git (push)

With the repo configuration as above, and following VSCode settings

{
    "github-enterprise.uri": "https://github3.abcd-comp.com",
    "githubPullRequests.remotes": [
        "origin",
        "upstream",
    ]
}

I am unable to see any PRs being listed in the VSCode.

Screenshot 2022-03-03 at 7 00 28 PM

[2022-03-03 18:56:35.177] [exthost] [info] Extension host with pid 2298 started
[2022-03-03 18:56:35.237] [exthost] [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc'
[2022-03-03 18:56:35.241] [exthost] [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
[2022-03-03 18:56:35.252] [exthost] [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
[2022-03-03 18:56:35.260] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
[2022-03-03 18:56:35.272] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: true, activationEvent: '*'
[2022-03-03 18:56:35.274] [exthost] [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.github
[2022-03-03 18:56:35.276] [exthost] [info] ExtensionService#_doActivateExtension GitHub.vscode-pull-request-github, startup: true, activationEvent: '*'
[2022-03-03 18:56:35.328] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
[2022-03-03 18:56:38.123] [exthost] [info] ExtensionService#_doActivateExtension vscode.git, startup: false, activationEvent: 'api', root cause: GitHub.vscode-pull-request-github
[2022-03-03 18:56:38.267] [exthost] [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
[2022-03-03 18:56:38.279] [exthost] [info] Eager extensions activated
[2022-03-03 18:56:38.284] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onStartupFinished'
[2022-03-03 18:56:38.288] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
[Info] Registering git provider
[Info] Looking for git repository
[Info] Found 0 repositories during activation
[Info] Git repository found, initializing review manager and pr tree view.
[Info] Repository file:///....... has been opened
[Info] Review> Validate state in progress
[Info] Review> Validating state...
[Info] Cannot updates repositories as git is uninitialized
[Info] Git initialization state changed: state=initialized
[Info] Review> Queuing additional validate state
[Info] Review> Validating state...
[Info] No remotes found. The following remotes are missing: origin, upstream, origin-https
[Info] No GitHub remotes found
[Info] Review> Queuing additional validate state
[Info] Repo state for file:///...... changed.
[Info] Repo file:///.... has already been setup.
[Info] Review> Validating state...
[Info] Found GitHub remote
[Info] Review> no matching pull request metadata found for current branch master
[Info] Review> no matching pull request metadata found on GitHub for current branch master
[Info] Found GitHub remote
[Info  - 13:56:35.342] Reading sessions from keychain...
[Info  - 13:56:38.118] Getting sessions for read:user,repo,user:email...
[Info  - 13:56:38.118] Got 0 sessions for read:user,repo,user:email...

Is there something I am doing wrong?

  • Extension version: v0.36.2
  • VSCode Version: 1.64.2 (Universal)
  • OS: OSx

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry @wrslatz I have been away from this space for a while and lost track of this thread. I switched to insiders with latest like @alexr00 suggested and I am able to manage GHE accounts properly so far. I am also able to manage my external repo access at the same time in a clean way as well. I did log out of the current session just to avoid confusion.

Folks who are seeing these issues: can you please try out VS Code Insiders with the latest pre-release version of the extension? There are some important changes there that might fix the issues you’re seeing:

  • No longer need a PAT
  • Better logic around deciding whether you should use GitHub Enterprise

You might need to sign out and sign back in again in VS Code to get things working.

Please do post back on whether it works or not!

@wrslatz If you are on macOS then you might give it a try by cleaning up the keychain entries for vscode github auth.

security find-generic-password -a github-enterprise.auth
security find-generic-password -a github.auth

delete and that should let you re-login. When you do so, use the Enterprise auth firs and then the public one. That is what worked for me.

When I was logged into the Public Github, it never provided me an option to Authenticate against the Enterprise git. and even when it did, it only worked after the above fix. Cleaning up the keychain and recreating helped. Been working for me since.

Hi @harshanarayana and @wrslatz I actually think this issue is a bit more severe than stated in this post. It actually stops you signing in if you are not signed into GitHub Enterprise

@harshanarayana I have taken your code and created a PR #3564 Though it can’t go as is, as I have also updated some md files with further information @wrslatz I have created a release for it

I’m fairly confident that the worst of the auth issues are solved for GitHub Enterprise so I’m closing this issue. If you encounter any other problems please open a new issue and include the version of GitHub Enterprise you’re using!

[Info - 18:58:11.568] Reading sessions from keychain… [Trace - 18:58:11.777] Token acquired from secret storage. [Info - 18:58:11.780] Got stored sessions! [Trace - 18:58:11.780] Read the following session from the keychain with the following scopes: read:user repo user:email [Info - 18:58:11.780] Got 1 verified sessions. [Info - 18:58:12.638] Getting sessions for read:user,repo,user:email… [Info - 18:58:12.645] Got 1 sessions for read:user,repo,user:email…

@wrslatz looking at your log your issue may be slightly different as you are getting a session back. Both @harshanarayana and I are getting 0 sessions back: Got 0 sessions for read:user,repo,user:email

But feel free to give it a go and see what happens

Cheers

James

I did some digging and looks like I found the quick fix.

if (authProviderId === AuthProvider['github-enterprise']) {
    getAuthSessionOptions = { ...getAuthSessionOptions, ...{ createIfNone: true, silent: false } };
}

Adding the above in src/github/credentials.ts under initialize seem to fix the issue. Looks like 7aebab4 seem to have broken a small case.

I rebuilt the extension with above changes and got it working until we get an official fix.