Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Redirects are not followed #579

Open
jayhogan opened this issue Oct 12, 2018 · 3 comments
Open

Redirects are not followed #579

jayhogan opened this issue Oct 12, 2018 · 3 comments

Comments

@jayhogan
Copy link

jayhogan commented Oct 12, 2018

Version: gh 1.13.5

My first experience using gh was working with a repo that I recently renamed. In this scenario, github will respond with a 301 and include the new url in the Location header field.

Here is a sample response:

{
    message: 'Moved Permanently',
    url: 'https://api.github.com/repositories/119537897/issues?state=open&labels=&access_token=xx',
    documentation_url: 'https://developer.github.com/v3/#http-redirects',
    meta: { 
       'x-ratelimit-limit': '5000',
       'x-ratelimit-remaining': '4941',
       'x-ratelimit-reset': '1539339189',
       'x-oauth-scopes': 'user, public_repo, repo, repo:status, delete_repo, gist',
       location: 'https://api.github.com/repositories/119537897/issues?state=open&labels=&access_token=xx',
       status: '301 Moved Permanently'
    }
}

Relevant github API docs: https://developer.github.com/v3/#http-redirects

I resolved the issue by updating the remote url in my local repo:

git remote set-url origin https://github.com/myOrg/my-new-repo-name.git
@protoEvangelion
Copy link
Member

@jayhogan Thanks for reporting!

Were you noticing this in previous versions?

Also what cmd(s) were you running when you ran into this?

@jayhogan
Copy link
Author

jayhogan commented Oct 31, 2018

Sorry for the late response. This was my first experience with node-gh so I have not tried previous versions of the tool. I encountered the problem with gh issue and gh pr but I would expect to see this issue with any command in a renamed repo.

There is a simple workaround (update your remote reference!) so I would consider this a low priority issue.

Thanks!

@protoEvangelion
Copy link
Member

Thanks for expanding on that @jayhogan. It's definitely something we should do!

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

No branches or pull requests

2 participants