MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / initialize

Method initialize

lib/cli/src/crewai_cli/git.py:74–82  ·  view source on GitHub ↗

Initialize a Git repository and create an initial commit if needed.

(cls, path: str = ".")

Source from the content-addressed store, hash-verified

72
73 @classmethod
74 def initialize(cls, path: str = ".") -> Repository:
75 """Initialize a Git repository and create an initial commit if needed."""
76 if not cls.is_git_installed():
77 raise ValueError("Git is not installed or not found in your PATH.")
78
79 subprocess.run(["git", "init"], cwd=path, check=True) # noqa: S607
80 repository = cls(path=path, fetch=False)
81 repository.create_initial_commit_if_needed()
82 return repository
83
84 def status(self) -> str:
85 """Get the git status in porcelain format."""

Calls 3

is_git_installedMethod · 0.80
runMethod · 0.45

Tested by 1