Hi friends,
Lets see “How to Create Centralized Local “Git Repository”
First we have to install “git-core” on both server and client. here I’m using Fedora, So I’m installing using “yum install”. Ubuntu people may use “apt-get install”
[server] $ sudo yum install git git-core
[client] $ sudo yum install git git-core
—-
[client side]
Go to the project Directory using “cd” command.
$ cd project_directory
$ git init
$ git add .
$git commit -m “First commit”
Assume your project is in the directory ~/project. Now we have to create a clone of that project using “–bare”
$ git clone –bare ~/project project.git
Next, copy project.git to the server where you plan to host the public repository. You can use scp, rsync, or whatever is most convenient.
$ scp -r project.git servername@ipaddress:/path_to_dir
Now we copied the project into the “Server Repository”.That’s All.
Then, When you need to clone (or) pull, Create new directory and go insde of that dire., When we cloned a project from server repo., just start with that cloned project and make modifications and make commits using “$ git commit -m “message” then just use “$ git push” to push the modified project. 🙂
$ mkdir cloned
$ cd cloned
$ git clone servername@ipaddress:/path_to_dir/project
Ex:
[rajee@localhost pro]$ git clone --bare sample_app/ sample_app.git
Cloning into bare repository sample_app.git...
done.
[rajee@localhost pro]$ scp -r sample_app.git/
suresh@192.168.1.9:/home/suresh/git-repo
[rajee@localhost ~]$ cd cloned/
[rajee@localhost cloned]$ ls
fapp testdir testdir.git
[rajee@localhost cloned]$ git clone suresh@192.168.1.9:/home/suresh/
git-repo/sample_app.git
Cloning into sample_app...
suresh@192.168.1.9's password:
remote: Counting objects: 491, done.
remote: Compressing objects: 100% (451/451), done.
remote: Total 491 (delta 210), reused 0 (delta 0)
Receiving objects: 100% (491/491), 214.64 KiB, done.
Resolving deltas: 100% (210/210), done.
[rajee@localhost cloned]$ ls
fapp sample_app testdir testdir.git
[rajee@localhost cloned]$
suresh@192.168.1.9's password:
[rajee@localhost rails_projects]$ cd sample_app
rajee@localhost rails_projects]$ # make modifications
[rajee@localhost rails_projects]$ git push
That’s all.

0.000000
0.000000