Search code examples
gitubuntuinstallationgoogle-colaboratorytorch

Git usage issue on Colab


I'm trying to use customised install scripts for Torch on Google Colab.

I've run into an issue with this code:

#!/usr/bin/env bash

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

Colab reports this to the git commands:

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


Solution

  • fatal: not a git repository (or any of the parent directories): .git means you attempted to run a Git command but weren’t inside a Git repository.

    The first command git fetch will fetch branches and/or tags from one or more other repositories, so the script should be placed inside a git repo.

    Be sure that you are in a git repo, do a git status or git remote -v to check if you're in a repo folder.

    You can invoke shell commands in Colab using either ! or %%shell in your cell : !pwd or !git status