pip:尝试从拉取请求安装时出现 "Reference is not a tree" 错误

pip: "Reference is not a tree" error when trying to install from a pull request

我正在尝试通过拉取请求进行安装。我听从了 that thread 的建议并做了:

pip3 install git+https://github.com/username/reponame.git@LastCommitFromPullRequest

我收到错误:

fatal: reference is not a tree: LastCommitFromPullRequest

我做错了什么?

作为参考,我尝试安装的拉取请求是 this one,而我 运行 的确切命令是:

pip3 install git+https://github.com/tweepy/tweepy.git@c130d708c3bda84666c2a5eef69d276cdeb17e86

您引用的提交 (c130d708) 是来自原始存储库的分支的开放拉取请求的一部分。这意味着当 PR 处于打开状态时,您不会在原始 repo 中找到该提交,而只会在 fork 中找到该提交。您可以通过将原始仓库的 url 替换为分叉的 url 来修复您的 pip 命令:

pip3 install git+https://github.com/fitnr/tweepy.git@c130d708c3bda84666c2a5eef69d276cdeb17e86

您也可以引用分支名称而不是提交:

pip3 install git+https://github.com/fitnr/tweepy.git@video_upload

但是如果分支从分叉中删除,这将失败。