PyGitUp icon indicating copy to clipboard operation
PyGitUp copied to clipboard

stderr: 'fatal: no such remote or remote group: https:

Open hugovk opened this issue 2 years ago • 2 comments

This uses gh - the GitHub CLI https://github.com/cli/cli - to checkout a branch from another remote.

Running git up with such a branch checked out fails with stderr: 'fatal: no such remote or remote group: https:.

I need to delete that branch for it to work.

For example:

$ python --version
Python 3.10.4
$ git --version
git version 2.35.1
$ git-up --version
GitUp version is: v2.1.0

$ git clone https://github.com/hugovk/pip
Cloning into 'pip'...
remote: Enumerating objects: 81800, done.
remote: Counting objects: 100% (641/641), done.
remote: Compressing objects: 100% (327/327), done.
remote: Total 81800 (delta 348), reused 520 (delta 266), pack-reused 81159
Receiving objects: 100% (81800/81800), 63.53 MiB | 5.48 MiB/s, done.
Resolving deltas: 100% (54662/54662), done.
$ cd pip
$ git up
Fetching origin
main  up to date
$ gh pr checkout 11001
? Which should be the base repository (used for e.g. querying issues) for this directory? pypa/pip
remote: Enumerating objects: 378, done.
remote: Counting objects: 100% (328/328), done.
remote: Compressing objects: 100% (118/118), done.
remote: Total 378 (delta 201), reused 295 (delta 183), pack-reused 50
Receiving objects: 100% (378/378), 176.94 KiB | 3.76 MiB/s, done.
Resolving deltas: 100% (201/201), completed with 39 local objects.
From https://github.com/pypa/pip
 * [new ref]             refs/pull/11001/head -> remove-out-of-tree
 * [new tag]             1.3rc1               -> 1.3rc1
...
 * [new tag]             22.0.4               -> 22.0.4
Switched to branch 'remove-out-of-tree'
$ git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
$ git up
`git fetch` failed

Here's what git said:


  stderr: 'fatal: no such remote or remote group: https:
'
$ git branch
* main
  remove-out-of-tree
$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = https://github.com/hugovk/pip
    fetch = +refs/heads/*:refs/remotes/origin/*
    gh-resolved = pypa/pip
[branch "main"]
    remote = origin
    merge = refs/heads/main
[branch "remove-out-of-tree"]
    remote = https://github.com/pradyunsg/pip.git
    pushRemote = https://github.com/pradyunsg/pip.git
    merge = refs/heads/remove-out-of-tree
$ git branch -D remove-out-of-tree
Deleted branch remove-out-of-tree (was 428e886ad).
$ git up
Fetching origin
main  up to date
$ cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = https://github.com/hugovk/pip
    fetch = +refs/heads/*:refs/remotes/origin/*
    gh-resolved = pypa/pip
[branch "main"]
    remote = origin
    merge = refs/heads/main

Possibly related to https://github.com/msiemens/PyGitUp/issues/101.

hugovk avatar Apr 08 '22 12:04 hugovk

I'll need to take some time to look deeper into this. GitHub CLI is really weird here, setting up a remote (remote = https://github.com/pradyunsg/pip.git) that doesn't even exist…

msiemens avatar Apr 13 '22 18:04 msiemens

It looks like GitHub CLI is just straight up using the URL as the remote instead of adding a separate remote.

I'm not sure if Git considers that legal, but it seems to be working through git fetch.

It's unfortunate that this completely breaks git-up because the github cli is quite useful as a maintainer. I can just to git checkout https://github.com/msiemens/PyGitUp/pulls (or something) and it will automatically checkout the pull request for me.

wolph avatar Dec 12 '22 22:12 wolph