Git & GitHub Interview Question #4

What is a Git repository?

Git Fundamentals, Repository, Working Tree, Staging, Commits & Branch Basics Junior Beginner

Quick Interview Answer

A Git repository is a project directory whose history and version-control metadata are managed by Git. A normal local repository contains the working files and a hidden .git directory that stores objects, references, configuration, and other Git metadata.

Detailed Explanation

A Git repository is a project directory whose history and version-control metadata are managed by Git. A normal local repository contains the working files and a hidden .git directory that stores objects, references, configuration, and other Git metadata.

A repository can be created locally with git init or copied from an existing remote repository with git clone.

Code Example

git init

# or
git clone https://github.com/username/project.git