DEV Community

Utsav Ladani
Utsav Ladani

Posted on

How to change base repo in Github CLI?

When you use Github cli for fist time on locally clone forked repo, then you get some message that asked to setup base repo to execute all queries.

$ gh issue list
? Which should be the base repository (used for e.g. querying issues) for this directory?  [Use arrows to move, type to filter]
  <name of owner> / <name of repo>
> <your name> / <name of repo>
Enter fullscreen mode Exit fullscreen mode

If you setup wrong repo here, then these is no any gh command to change base repo. I face this issue, but not found solution easily.

The solution is:

  1. Open .git/config file
  2. Remove line gh-resolved = base
  3. Save the file and close

OR you can use this command

$ git config --unset  remote.upstream.gh-resolved
Enter fullscreen mode Exit fullscreen mode

That's it, now you prompted again to select repo. Select correct repo and go ahead.

For more info refer this discussion on Github: https://github.com/cli/cli/issues/1864

Discussion (0)