Create a New Repository on the Command Line

First, let’s create a new folder in our $HOME directory on stampede2 to organize our work:

$ cd ~/
$ mkdir my_first_repo/
$ cd my_first_repo/       # currently empty

Then we will use a Git command to initialize this directory as a new Git repository - or a place where Git can start to organize versions of our files.

$ git init
Initialized empty Git repository in /home1/03762/eriksf/my_first_repo/.git/

If we use ls -a, we can see that Git has created a hidden directory within my_first_repo called .git:

$ ls -a
./  ../  .git/

Use the find command to get a overview of the contents of the .git/ directory:

$ find .git/

Git uses this special sub-directory to store all the information about the project, including all files and sub-directories located within the project’s directory. If we ever delete the .git sub-directory, we will lose the project’s history.

We can check that everything is set up correctly by asking Git to tell us the status of our project:

$ git status
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)

If you are using a different version of git, the exact wording of the output might be slightly different.


  1. Explore the files and folders in the .git/ directory
  2. Can you find a file with your name and e-mail in it? How did it get there?