3. Creating a Project

Goals

  • 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.

Run:

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.

Run:

git init

Result:

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

03 Add the page to the repository

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

Run:

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

You will see …

Result:

$ 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
SVN?
© 2011-2014 Git How To. All rights reserved / Contact us