git python poetry无法克隆验证远程上存在ref

zdwk9cvp  于 2023-03-21  发布在  Git
关注(0)|答案(2)|浏览(110)

我在ubuntu 22.04上使用poetry 1.4.0,并尝试将特定的git分支添加到我的项目中:

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.

这很奇怪,因为手动git clone是有效的:

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.

你知道吗?
注意:服务器和客户端上的GIT版本都是2.34.1

t9eec4r0

t9eec4r01#

以防万一,如问题835中所述,验证远程分支确实存在。
您所做的手动克隆将默认检出main分支,而不是“nanosecond_fix”分支。
不过,在手动克隆中,您可以列出所有本地和远程分支:

git branch -avv

如果分支存在,可以switch branch in a bare repository

git symbolic-ref HEAD refs/heads/nanosecond_fix
zsbz8rwp

zsbz8rwp2#

把它放在你的依赖项pyproject.toml上:

[tool.poetry.dependencies]
repository_name = { git = "git@github.com/myorganization/myprivaterepo.git", branch = "master" }

相关问题