Git Quick Start

This post is just a quick reminder on how to start and use git for your project.

First of all, server side (via a private repository) :

cd /path/to/your/git/repositories/
mkdir my_project.git
cd my_project.git
git --bare init

Then, on your computer, do that :

# create your project (we suppose it will be at /home/user/projects/my_project)
cd /home/user/projects/my_project
git init
git add .
git commit -a -m "First commit"
git remote add origin ssh://user@server.com/path/to/your/git/repositories/my_project.git
git push origin master

Extra bonus, for Play! Frameworks fans, here's a nice gitignore file to create :

# create a .gitignore file at the root of your project containing those lines :
bin/
data/
dist/
logs/
test-result/
tmp/
modules/
eclipse/
.settings/
*.swp
.classpath
.project

And voilà !

(thanks to Nicolas about that!)

Filed under  //  git   private   repository  
Posted by Cyril Nicodème