Git: Prepare your repository – step 1

 

Here I’ll explain how you can create a new repository for your projects and use GIT for your version control needs.
 
 
For this, I’ll assume everything is already installed (git and stuff). This also assumes you’re using an Operating System and not the Vermont thing.
 
Replace “example.com” with your own domain.
 
1. Create a base repository
 
$ mkdir example.com && cd example.com

$ git init
 
 
2. Create a standard .gitignore file
 
$ nano .gitignore
 
—————————-
cgi-bin/*

upload/

.idea/*

# Compiled source #

###################

*.com

*.class

*.dll

*.exe

*.o

*.so

# Packages #

############

# it's better to unpack these files and commit the raw source

# git has its own built in compression methods

*.7z

*.dmg

*.gz

*.iso

*.jar

*.rar

*.tar

*.zip

# Logs and databases #

######################

*.log

*.sql

*.sqlite

# OS generated files #

######################

.DS_Store*

ehthumbs.db

Icon?

Thumbs.db
—————————-
 
3. Add and commit the file to your local repository.
$ git add .gitignore

$ git commit -m "Added standard gitignore file"
 
4. Prepare your local repository for transportation:
$ cd ..

$ git clone --bare example.com example.com.git

$ touch example.com.git/git-daemon-export-ok
 
5. Copy it to your server
$ scp -r example.com.git SERVER:~/PATH_ON_THE_SERVER/example.com.git
 
6. Finish preparing your repository on the server:
 
$ ssh SERVER

$ cd ~/PATH_ON_THE_SERVER/example.com.git

$ git --bare update-server-info

$ cd hooks

$ mv post-update.sample post-update

$ chmod a+x post-update
 
From this point on, you should be able to clone your repository and start working.
 
Drop me a line if this does not work for you, and I'll be glad to try and help.
 

 

Tagged , , . Bookmark the permalink.

Leave a Reply