使用 GitPython 克隆一个 repo 会显示 "无法预加载打包文件。No such file or directory error"

问题描述 投票:2回答:1

我正在使用 GitPython 将 GitHub 上的一个仓库克隆到 databricks 的 dbfs 位置,如下所示,但 gitpython 显示以下错误(我启用了 GIT_PYTHON_TRACE=1 & GIT_TRACE_PACKET=1)。

outdir = "dbfs:/tmp/project"
repo = Repo.clone_from('https://<github token>@github.com/xyz/project.git', outdir, branch='master')

但gitpython显示了以下错误(我启用了GIT_PYTHON_TRACE=1 & GIT_TRACE_PACKET=1)。

GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git clone --branch=master -v https://<github token>@github.com/xyz/project.git /dbfs/tmp/project
  stderr: '10:47:50.269995 git.c:344               trace: built-in: git 'clone' '--branch=master' '-v' 'https://<github token>@github.com/xyz/project.git' '/dbfs/tmp/project'
Cloning into '/dbfs/tmp/project'...
10:47:54.849690 run-command.c:334       trace: run_command: 'git-remote-https' 'origin' 'https://<github token>@github.com/xyz/project.git'
10:47:55.127316 pkt-line.c:80           packet:          git< # service=git-upload-pack
10:47:55.127342 pkt-line.c:80           packet:          git< 0000
10:47:55.127350 pkt-line.c:80           packet:          git< 9ca6ebc37f3b520522b3b122752980deaa731118 HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed allow-tip-sha1-in-want allow-reachable-sha1-in-want no-done symref=HEAD:refs/heads/master filter agent=git/github-g8c0f36024410
10:47:55.127358 pkt-line.c:80           packet:          git< 9ca6ebc37f3b520522b3b122752980deaa731118 refs/heads/master
10:47:55.127363 pkt-line.c:80           packet:          git< dda701fe8b184376d38a39b41b5e5480dfe4f671 refs/heads/mccoy04041991-mlflow
10:47:55.127368 pkt-line.c:80           packet:          git< dda701fe8b184376d38a39b41b5e5480dfe4f671 refs/pull/1/head
10:47:55.127373 pkt-line.c:80           packet:          git< ab6fd089edc1ac4823f36cfc1af0606845b9f10e refs/pull/1/merge
10:47:55.127377 pkt-line.c:80           packet:          git< 0000
10:47:55.427723 pkt-line.c:80           packet:          git> 9ca6ebc37f3b520522b3b122752980deaa731118 refs/heads/master
10:47:55.427741 pkt-line.c:80           packet:          git> 9ca6ebc37f3b520522b3b122752980deaa731118 refs/heads/master
10:47:55.427745 pkt-line.c:80           packet:          git> dda701fe8b184376d38a39b41b5e5480dfe4f671 refs/heads/mccoy04041991-mlflow
10:47:55.427748 pkt-line.c:80           packet:          git> 0000
10:47:55.427765 run-command.c:334       trace: run_command: 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' '--no-progress' 'https://<github token>@github.com/xyz/project.git/'
10:47:55.428430 exec_cmd.c:120          trace: exec: 'git' 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' '--no-progress' 'https://<github token>@github.com/xyz/project.git/'
10:47:55.944975 git.c:344               trace: built-in: git 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack' '--thin' '--check-self-contained-and-connected' '--cloning' '--no-progress' 'https://<github token>@github.com/xyz/project.git/'
10:47:55.945055 pkt-line.c:80           packet:   fetch-pack< 9ca6ebc37f3b520522b3b122752980deaa731118 refs/heads/master
10:47:55.945062 pkt-line.c:80           packet:   fetch-pack< 9ca6ebc37f3b520522b3b122752980deaa731118 refs/heads/master
10:47:55.945066 pkt-line.c:80           packet:   fetch-pack< dda701fe8b184376d38a39b41b5e5480dfe4f671 refs/heads/mccoy04041991-mlflow
10:47:55.945070 pkt-line.c:80           packet:   fetch-pack< 0000
10:47:55.945075 pkt-line.c:80           packet:   fetch-pack< 9ca6ebc37f3b520522b3b122752980deaa731118 HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed allow-tip-sha1-in-want allow-reachable-sha1-in-want no-done symref=HEAD:refs/heads/master filter agent=git/github-g8c0f36024410
10:47:55.945080 pkt-line.c:80           packet:   fetch-pack< 9ca6ebc37f3b520522b3b122752980deaa731118 refs/heads/master
10:47:55.945084 pkt-line.c:80           packet:   fetch-pack< dda701fe8b184376d38a39b41b5e5480dfe4f671 refs/heads/mccoy04041991-mlflow
10:47:55.945087 pkt-line.c:80           packet:   fetch-pack< dda701fe8b184376d38a39b41b5e5480dfe4f671 refs/pull/1/head
10:47:55.945091 pkt-line.c:80           packet:   fetch-pack< ab6fd089edc1ac4823f36cfc1af0606845b9f10e refs/pull/1/merge
10:47:55.945094 pkt-line.c:80           packet:   fetch-pack< 0000
10:47:56.598867 pkt-line.c:80           packet:   fetch-pack> want 9ca6ebc37f3b520522b3b122752980deaa731118 multi_ack_detailed no-done side-band-64k thin-pack no-progress ofs-delta agent=git/2.7.4
10:47:56.598888 pkt-line.c:80           packet:   fetch-pack> want dda701fe8b184376d38a39b41b5e5480dfe4f671
10:47:56.598892 pkt-line.c:80           packet:   fetch-pack> 0000
10:47:56.598896 pkt-line.c:80           packet:   fetch-pack> done
10:47:56.598907 pkt-line.c:80           packet:   fetch-pack> 0000
10:47:56.598946 pkt-line.c:80           packet:          git< 008bwant 9ca6ebc37f3b520522b3b122752980deaa731118 multi_ack_detailed no-done side-band-64k thin-pack no-progress ofs-delta agent=git/2.7.40032want dda701fe8b184376d38a39b41b5e5480dfe4f67100000009done
10:47:56.598966 pkt-line.c:80           packet:          git< 0000
POST git-upload-pack (202 bytes)
10:47:56.732107 pkt-line.c:80           packet:   fetch-pack< NAK
10:47:56.732121 pkt-line.c:80           packet:   fetch-pack> 0000
10:47:56.742802 pkt-line.c:80           packet:     sideband< PACK ...
10:47:56.742909 run-command.c:334       trace: run_command: 'index-pack' '--stdin' '--fix-thin' '--keep=fetch-pack 3079 on 0427-184217-chew477-10-220-226-214' '--check-self-contained-and-connected' '--pack_header=2,990'
10:47:56.743191 exec_cmd.c:120          trace: exec: 'git' 'index-pack' '--stdin' '--fix-thin' '--keep=fetch-pack 3079 on 0427-184217-chew477-10-220-226-214' '--check-self-contained-and-connected' '--pack_header=2,990'
10:47:57.191239 git.c:344               trace: built-in: git 'index-pack' '--stdin' '--fix-thin' '--keep=fetch-pack 3079 on 0427-184217-chew477-10-220-226-214' '--check-self-contained-and-connected' '--pack_header=2,990'
10:48:03.761742 pkt-line.c:80           packet:          git< 0000
10:48:05.488992 pkt-line.c:80           packet:     sideband< 0000
fatal: cannot pread pack file: No such file or directory
fatal: index-pack failed

我正在克隆的版本库不包含大文件,但仍然会显示这个错误。如何将远程仓库成功克隆到 databricks dbfs 上?

github databricks gitpython
1个回答
0
投票

我从这个链接分享这个答案。https:/forums.databricks.comquestions8066access-data-in-github.html。

在你的笔记本中使用这个命令来克隆仓库到你的驱动机中。

%sh git clone https://github.com/path_to_project

用这个命令来查看驱动中的文件。

%sh ls -al
© www.soinside.com 2019 - 2024. All rights reserved.