Python poetry Failed to clone verify ref exists on remote

Question:

I am using poetry 1.4.0 on ubuntu 22.04, and trying to add a specific git branch into my project :

poetry add git+ssh://git@dev/home/git/projects/jaydebeapi#nanosecond_fix

Failed to clone ssh://git@dev/home/git/projects/jaydebeapi at 'nanosecond_fix', verify ref exists on remote.

This is strange because manual git clone works :

git clone -b nanosecond_fix ssh://git@dev/home/git/projects/jaydebeapi
Cloning into 'jaydebeapi'...
remote: Counting objects: 1592, done.
remote: Compressing objects: 100% (572/572), done.
remote: Total 1592 (delta 879), reused 1592 (delta 879)
Receiving objects: 100% (1592/1592), 397.30 KiB | 4.14 MiB/s, done.
Resolving deltas: 100% (879/879), done.

Any idea ?

NOTE : GIT version is 2.34.1 on both server and client

Asked By: Eric

||

Answers:

Just in case, as in issue 835, verify the remote branch does exist.

The manual clone you have done would check out by default the main branch, not a ‘nanosecond_fix‘ branch.

Inside your manual clone, though, you can list all local and remote branches:

git branch -avv

If the branch exists, you can switch branch in a bare repository:

git symbolic-ref HEAD refs/heads/nanosecond_fix 
Answered By: VonC

Put this on your dependencies pyproject.toml:

[tool.poetry.dependencies]
repository_name = { git = "[email protected]/myorganization/myprivaterepo.git", branch = "master" }
Answered By: fredmanre
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.