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 git init
in order to create a git repo from that directory.
Run:
git init
Result:
$ 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.
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