Colab上的Git使用问题

问题描述

我正在尝试针对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命令:

致命:不是git存储库(或任何父目录):.git

解决方法

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

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

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

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