3. Creating a Project


  • To learn how to create a git repository from scratch.

01 Create a “Hello, World” page

Get started in an empty working directory (for example, Work, if you downloaded the file from the previous step) and create an empty directory named “hello”, then create a hello.html file in it with the following contents.


mkdir hello
cd hello
touch hello.html

File: hello.html

Hello, World

02 Create a repository

So you have a directory that contains one file. Run the git init in order to create a git repo from that directory.


git init


$ git init
Initialized empty Git repository in /Users/alex/Documents/Presentations/githowto/auto/hello/.git/

03 Add the page to the repository

Now let’s add the “Hello, World” page to the repository.


git add hello.html
git commit -m "First Commit"

You will see …


$ git add hello.html
$ git commit -m "First Commit"
[master (root-commit) 911e8c9] First Commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 hello.html