profile for joel goldstick at Stack Overflow, Q&A for professional and enthusiast programmers

JoelGoldstick.com

Creating a git repository

Categories: git

Published on April 19, 2016

Last Modified on April 19, 2016

For each project you want to track with git, you need to create a directory to be the top level of your project. Then go to that directory (with the cd command). Once there type git init

Here is an example:

cg@jcg-netbook:~/code$ cd git_course
jcg@jcg-netbook:~/code/git_course$ git init
Initialized empty Git repository in /home/jcg/code/git_course/.git/
jcg@jcg-netbook:~/code/git_course$ ls -atl
total 12
drwxrwxr-x 7 jcg jcg 4096 Apr 19 13:08 .git
drwxrwxr-x 3 jcg jcg 4096 Apr 19 13:08 .
drwxrwxr-x 8 jcg jcg 4096 Apr 19 13:08 ..
.
└── .git
    ├── branches
    ├── config
    ├── description
    ├── HEAD
    ├── hooks
    │   ├── applypatch-msg.sample
    │   ├── commit-msg.sample
    │   ├── post-update.sample
    │   ├── pre-applypatch.sample
    │   ├── pre-commit.sample
    │   ├── prepare-commit-msg.sample
    │   ├── pre-push.sample
    │   ├── pre-rebase.sample
    │   └── update.sample
    ├── info
    │   └── exclude
    ├── objects
    │   ├── info
    │   └── pack
    └── refs
        ├── heads
        └── tags