jasonnutter / vscode-github-pr

VS Code plugin for working with Github PRs.
https://marketplace.visualstudio.com/items?itemName=jasonnutter.github-pr
MIT License
5 stars 3 forks source link

Trouble using with GitHub Enterprise #8

Open vijaykota opened 6 years ago

vijaykota commented 6 years ago

Hi, I am looking for help on configuring the extension to use with GitHub Enterprise. It currently fails for me with foll. pop-up:

Github PR: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}

My extension settings look like:

    "github-pr.accessTokens": {
        "https://git.mycompany.com": "foo_user:token"
    }

The foll. curl command line works fine

curl -u foo_user:token https://git.mycompany.com/api/v3/user

Would appreciate any pointers.

Thanks!

vijaykota commented 6 years ago

From a Wireshark capture, I see that SSL connection is being established with api.github.com instead of git.mycompany.com.

Do I need to set github-pr.targetRemote to something other than origin? From the code at https://github.com/jasonnutter/vscode-github-pr/blob/2ba733ffa8ad381d608f3e753a32bd0a0d9e5057/src/workflows.js#L245 , it seems like a hint is needed to figure out the repoHost.

jasonnutter commented 6 years ago

I don't believe you need to include your user name for the token value in github-pr.accessTokens, e.g.:

 "github-pr.accessTokens": {
        "https://git.mycompany.com": "token"
    }

Can you please try that and let me know if you still have issues?

And I'm not sure why it would be trying to call api.github.com, I'll see if I can figure out why that would be happening.

jkxdev commented 5 years ago

i have tried both

"github-pr.accessTokens": {
        "https://git.mycompany.com": "foo_user:token"
    }

and

"github-pr.accessTokens": {
        "https://git.mycompany.com": "token"
    }

both still giving me Github PR: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}

jasonnutter commented 5 years ago

@jkxdev I'm having trouble reproducing this (granted, I don't have access to a Github Enterprise server). What format is the remote address in, something like this: git@git.mycompany.com:group/name.git or something else?

jkxdev commented 5 years ago

@jkxdev I'm having trouble reproducing this (granted, I don't have access to a Github Enterprise server). What format is the remote address in, something like this: git@git.mycompany.com:group/name.git or something else?

Yes it is like git@git.mycompany.com:group/name.git

bviswana101 commented 4 years ago

@jkxdev @jasonnutter Did we resolve this? I am hitting this with GHE where my curl command to apis succeed. curl -v -v -v : https://github.xyz.com/api/v3/user< HTTP/1.1 200 OK < Server: openresty < Date: Thu, 30 Jan 2020 07:24:08 GMT < Content-Type: application/json; charset=utf-8 < Content-Length: 1371 < Connection: keep-alive < X-RateLimit-Limit: 5000 < X-RateLimit-Reset: 1580372648 < X-RateLimit-Remaining: 5000 < Status: 200 OK < Cache-Control: private, max-age=60, s-maxage=60 < Vary: Accept, Authorization, Cookie, X-GitHub-OTP < ETag: "2865c285ebeb3bbea1dbc5d57065f209" < Last-Modified: Wed, 29 Jan 2020 15:45:45 GMT < X-OAuth-Scopes: admin:repo_hook, repo < X-Accepted-OAuth-Scopes: < X-GitHub-Enterprise-Version: 2.17.14 < X-GitHub-Media-Type: github.v3; format=json < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type < Access-Control-Allow-Origin: * < X-GitHub-Request-Id: caa3e9de-bd8a-4bd6-80b4-82f2a2bdd44e < Strict-Transport-Security: max-age=31536000; includeSubdomains < X-Frame-Options: deny < X-Content-Type-Options: nosniff < X-XSS-Protection: 1; mode=block < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin < Content-Security-Policy: default-src 'none' < X-Runtime-rack: 0.044528