You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a repository that was moved from one organization to another. The remote origin was still pointing to the old org, which works transparently when pushing and pulling code.
gh fails recognize that the repository has moved.
gh version 0.5.4 (2020-02-10)
https://github.com/cli/cli/releases/tag/v0.5.4
Steps to reproduce the behavior
Create and clone a repo
Move this repo to another org (or github profile)
run gh pr list on this cloned code (cloned before the move)
See the error: graphql error: 'Could not resolve to a Repository with the name '<repo-name>'.'
Expected vs actual behavior
Expected the PR to be listed.
Logs
Here is an example of this behavior. After changing the remote URL gh worked.
> gh pr list
Pull requests for b2w-bit/async-worker
graphql error: 'Could not resolve to a Repository with the name 'async-worker'.'
> git remote -v
origin github.com:b2w-bit/async-worker (fetch)
origin github.com:b2w-bit/async-worker (push)
> git remote set-url origin github.com:b2wdigital/async-worker
> gh pr list
Pull requests for b2wdigital/async-worker
#151 Generate HTML Docs feature/new-docs-html-generated
#150 Feature/sphinx docs structure feature/sphinx-docs-structure
I tested the repo move bug and I could not reproduce this. Note: my repo and org were public and both mine, if it matters.
Here are my logs while testing on v0.5.4:
➜ tests git:(master) ✗ git clone https://github.com/tierninho/sdsdsdffsd
➜ tests git:(master) ✗ cd sdsdsdffsd
➜ sdsdsdffsd git:(master) gh pr list
Pull requests for tierninho/sdsdsdffsd
#1 sdfsdf tierninho-patch-1
➜ sdsdsdffsd git:(master) gh issue list
Issues for tierninho/sdsdsdffsd
#2 sdfsd
➜ sdsdsdffsd git:(master) git remote -v
origin https://github.com/tierninho/sdsdsdffsd (fetch)
origin https://github.com/tierninho/sdsdsdffsd (push)
➜ sdsdsdffsd git:(master) gh pr list
Pull requests for tierninho/sdsdsdffsd
#1 sdfsdf tierninho-patch-1
➜ sdsdsdffsd git:(master) gh issue list
Issues for tierninho/sdsdsdffsd
#2 sdfsd
➜ sdsdsdffsd git:(master) git remote -v
origin https://github.com/tierninho/sdsdsdffsd (fetch)
origin https://github.com/tierninho/sdsdsdffsd (push)
I could also verify the data in the newly transferred repo once I cd into that direcotry. Should we even be allowing access to data in the "old" repo if it is transferred to another org?
As for the renamed repo, I had no issues either and my logs were similar.
Activity
mgattozzi commentedon Feb 10, 2020
This exact same behavior also occurs for repos that were renamed.
[-]gh fails on a Repo that was moved[/-][+]gh fails on a Repo that was moved or renamed[/+]tierninho commentedon Feb 11, 2020
Here are my logs while testing on v0.5.4:
I could also verify the data in the newly transferred repo once I
cdinto that direcotry. Should we even be allowing access to data in the "old" repo if it is transferred to another org?daltonmatos commentedon Feb 11, 2020
In fact, now seeing yout check I also created a new repo and did these checks:
ghworked in every step, even using the original remote url.But still, I have this repo (https://github.com/b2wdigital/async-worker) that used to belong to
b2w-bitorg (https://github.com/B2W-BIT) and now belongs tob2wdigitalorg (https://github.com/b2wdigital). If I point the remote to the old orgghfails. If I change to the newghworks. Don't know why.The only difference is that when we changed this project from one org to the other we didn't transfered ownership we renamed the whole org.
I will try do do more checks to see if I can find anything.
daltonmatos commentedon Feb 11, 2020
With a fresh new clone I was able to reproduce the problem. Note: I cloned the project using the old URL.
Maybe this could be a good starting point to debug the code. The project is public so if anyone could try this too.
Note: The same behavior happens when clonning via https.
Thanks,
tierninho commentedon Feb 11, 2020
@daltonmatos thanks for the update on this. I can reproduce this, however I believe the results are expected and this is not a bug.
Anytime you rename an org means you have to update your local repos to the new location, as outlined in the warning ahead of making the change:
I could not break the flow until I decided to rename the org.
Steps were:
gh issue listworksgh issue listerrors out (as expected)gh issue listworksHappy to look into this further. Until then removing the
buglabel and closing the issue.daltonmatos commentedon Feb 11, 2020
Sure. Thanks.
iterative tools (cli#345)