【发布时间】:2021-02-16 12:50:56
【问题描述】:
我正在尝试使用 GitPython 库从笔记本中克隆托管在 Azure DevOps 上的 git 存储库。我在 git 存储库上生成了具有读/写访问权限的个人访问令牌。
目的是将 git 存储库保留在 DBFS 中,因为它不仅会填充笔记本源,还会填充输出和 MLFlow 模型。
为此,我尝试了以下方法,但仍然面临来自 Git 的错误 128:
from git import Repo
git_url = 'https://<myPAT>@dev.azure.com/<org>/<project>/_git/<repo>'
repo = Repo.clone_from(git_url, '/git/')
总是导致错误,没有更多细节:
GitCommandError: Cmd('git') failed due to: exit code(128)
我从其他地方检查过,我的 PAT 工作正常。
我也试过用 Base64 编码 PAT 并使用下面的命令添加标题'Authorization : Basic <base64PAT>',但结果是一样的。
encodedBytes= base64.urlsafe_b64encode(PAT.encode("utf-8"))
base64PAT= str(encodedBytes, "utf-8")
header = 'Authorization : Basic ' + base64PAT
git.Git().config_writer().set_value("http", "extraHeader", header).release()
对此有任何提示吗? GitPython 是否依赖于我需要更新的另一个配置,还是应该使用其他方法?
【问题讨论】:
标签: git azure-devops azure-databricks azure-notebooks