Creating a Repository

View saved

Initialize a new repository

Inside an empty or existing project folder, git init creates a hidden .git directory that stores history and metadata.

mkdir notes
cd notes
git init

Confirm you are inside a repo

Git reports the current branch and that there are no commits yet.

git status

Create a first file

Add a simple file so the next lesson has something to stage and commit.

echo "# Notes" > README.md
git status

Know when to clone instead

If the project already exists on GitHub, clone it rather than initializing an empty folder. Cloning downloads the history and sets up the remote in one step.

git clone https://github.com/example/notes.git
cd notes

Comments

One comment per signed-in account. Comments are saved with this page’s URL.