ImportError: No module named git after reformatting laptop

The git module is not the same thing as the git command line executable. They happen to have the same name and cover related tasks, but they are distinct software packages.

I'm going to assume that the git module your code is importing is the one provided by the GitPython project. You'll need to install that project, see their installation instructions:

# pip install gitpython

In my cas, I installed pythong2-git, it solved my problem.

sudo apt-get install python3-git

In my case apt install python-git fixed the issue.

Tags:

Python

Git