File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 22from pathlib import Path
33import sys
44import git
5+ from git import GitCommandError
56from shutil import move
67from .printing import *
78from .config import get_config
@@ -71,8 +72,12 @@ def safe_git_init(dir_path) -> (git.Repo, bool):
7172 """
7273 if not os .path .isdir (os .path .join (dir_path , ".git" )):
7374 print_yellow_bold ("Initializing new git repo..." )
74- repo = git .Repo .init (dir_path )
75- return repo , True
75+ try :
76+ repo = git .Repo .init (dir_path )
77+ return repo , True
78+ except GitCommandError :
79+ print_red_bold ("ERROR: We ran into some trouble creating the git repo. Double check that you have write permissions." )
80+ sys .exit (1 )
7681 else :
7782 print_yellow_bold ("Detected git repo." )
7883 repo = git .Repo (dir_path )
You can’t perform that action at this time.
0 commit comments