How To Git Without A Central Server

Do you like this?

This short post shows you a trick to use GIT without having a central GIT server.


The key idea is to use our local file system to act as a Git repository so that we can still commit our changes and keep them recorded somewhere. On your local computer, let's say you keep your projects' folders under D:\pkg and we're going to use D:\git-repos as our repository's folder.

Central repository:

cd D:\git-repos
mkdir foo.git
cd foo.git
git init --bare
Your project:
mkdir foo
cd foo
git init
// add files
git add .
git commit -m "Initial commit"
git remote add origin D:\git-repos\foo.git
git push origin master
git clone D:\git-repos\foo.git

comments powered by Disqus