Git Colab 的使用问题

Git usage issue on Colab

我正在尝试在 Google Colab 上为 Torch 使用自定义安装脚本。

我 运行 遇到此代码的问题:

#!/usr/bin/env bash

git fetch
git reset --hard
# Submodule update is done inside install.sh
/root/torch/install.sh -s

Colab 将此报告给 git 命令:

fatal: not a git repository (or any of the parent directories): .git

fatal: not a git repository (or any of the parent directories): .git 表示您尝试 运行 一个 Git 命令但不在 Git 存储库中。

第一个命令 git fetch 将从一个或多个其他存储库中获取分支 and/or 标记,因此脚本应放在 git 存储库中。

确保您在 git 存储库中,执行 git statusgit remote -v 检查您是否在存储库文件夹中。

您可以在单元格中使用 !%%shell 在 Colab 中调用 shell 命令:!pwd!git status