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

Unable to Access Enterprise Git Pull Requests #3371

Closed
harshanarayana opened this issue Mar 3, 2022 · 15 comments
Closed

Unable to Access Enterprise Git Pull Requests #3371

harshanarayana opened this issue Mar 3, 2022 · 15 comments
Labels
GitHubEnterprise help wanted Issues identified as good community contribution opportunities

Comments

@harshanarayana
Copy link

❯ 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
@alexr00 alexr00 added GitHubEnterprise help wanted Issues identified as good community contribution opportunities labels Mar 7, 2022
@harshanarayana
Copy link
Author

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.

@wrslatz
Copy link

wrslatz commented Mar 14, 2022

@harshanarayana could you expand on the potential fix here? We're running into the same issue, I believe.

If you get time to put up a PR, I'd be happy to test it and ensure it fixes things for us locally (once I figure out how to build from source and test locally).

@wrslatz
Copy link

wrslatz commented Mar 14, 2022

Here's some additional issue and log details from my end as well

Debug info
  • Extension version: v0.38.1
  • VSCode Version: 1.65.0
  • OS: MacOS Big Sur 11.6.4

Remotes:

origin	https://github.host.com/org/repo.git (fetch)
origin	https://github.host.com/org/repo.git (push)

Extension settings:

  "github-enterprise.uri": "https://github.host.com/",
  "githubPullRequests.defaultMergeMethod": "squash",
  "githubPullRequests.logLevel": "debug",

GitHub Enterprise Authentication output:

[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...

GitHub Pull Request output:

[Debug 1647284287.099s] /Users/user/.ssh/config: ENOENT: no such file or directory, open '/Users/user/.ssh/config'
[Debug 1647284288.184s] Activation> Creating API implementation.
[Debug 1647284288.184s] Activation> Initializing state.
[Debug 1647284288.184s] Activation> Creating credential store.
[Debug 1647284292.435s] Authentication> No GitHub token found.
[Debug 1647284294.645s] Activation> Registering built in git provider.
[Debug 1647284294.646s] Registering git provider
[Debug 1647284294.646s] Activation> Registering live share git provider.
[Debug 1647284294.647s] Activation> Creating tree view.
[Debug 1647284294.647s] Looking for git repository
[Debug 1647284294.647s] Found 1 repositories during activation
[Debug 1647284294.648s] Git repository found, initializing review manager and pr tree view.
[Debug 1647284294.65s] Review> Validate state in progress
[Debug 1647284294.65s] Review> Validating state...
[Debug 1647284295.778s] GitHubServer> Host https://github.host.com/org/repo is associated with GitHub: false
[Debug 1647284295.778s] No remotes found. The following remotes are missing: origin, upstream

@jpspringall
Copy link
Contributor

jpspringall commented May 21, 2022

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

@wrslatz
Copy link

wrslatz commented May 21, 2022

I'm on vacation but am happy to test this out when I return! Thanks for putting this together, hopefully this fixes things 🙏🏻

@jpspringall
Copy link
Contributor

[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

@harshanarayana
Copy link
Author

harshanarayana commented May 21, 2022

@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.

@harshanarayana
Copy link
Author

Thanks @jpspringall I have been kind of pre-occupied for a while with some other contributions and lost track of this as the local patch has been serving me well so far and I have been using a custom build of the plugin since. Thanks for opening the PR. Hopefully we can get this change merged. 🤞

jpspringall added a commit to jpspringall/vscode-pull-request-github that referenced this issue May 21, 2022
alexr00 pushed a commit that referenced this issue May 30, 2022
…ise AuthProvider (#3565)

Resolves Unable to Access Enterprise Git Pull Requests #3371
@wrslatz
Copy link

wrslatz commented Aug 5, 2022

I tested after the latest release and it still doesn't work. My guess is that it's a proxy issue, which leads me to microsoft/vscode#12588. Going to do more debugging and see what I find.

Edit: VSCode also doesn't allow a custom no_proxy setting, as that's what I was going to test next.
image

@wrslatz
Copy link

wrslatz commented Sep 5, 2022

Any tips for debugging this further? Happy to do additional troubleshooting if y'all have recommendations.

The debug output doesn't show any errors, which makes me think something in the auth / interaction with our GHES instance isn't actually erroring but is not correctly handled by the extension. Not sure the best way to rule out proxy either.

Also, I'll add that our current GHES version is 3.3.3. And I've made sure my token has workflow scope permissions, which I saw in other issues was tripping people up.

@alexr00
Copy link
Member

alexr00 commented Sep 20, 2022

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!

@harshanarayana
Copy link
Author

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.

@alexr00
Copy link
Member

alexr00 commented Sep 20, 2022

@harshanarayana thank you for trying out the changes so quickly!

@wrslatz
Copy link

wrslatz commented Sep 20, 2022

Going to test this today hopefully!

@alexr00
Copy link
Member

alexr00 commented Sep 21, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GitHubEnterprise help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

4 participants