Poor man git

· notat's blog


pman

Create a git repo with a central GIT server. #

Step 1: Connect to server, create a new, empty directory there and initialize an empty repository. #

This directory is mere a structure that contains all the elements to manage your files.

ssh server.com
mkdir myrepo.git 
cd myrepo.git
git --bare init
exit

It will end up looking like this:

_[myrepo]>tree
.
├── branches
├── config
├── description
├── HEAD
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── fsmonitor-watchman.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── pre-merge-commit.sample
│   ├── prepare-commit-msg.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   ├── pre-receive.sample
│   ├── push-to-checkout.sample
│   └── update.sample
├── info
│   └── exclude
├── objects
│   ├── info
│   └── pack
└── refs
    ├── heads
    └── tags

Thats it.

Step 2: Local machine. #

cd myrepo
git init

Step 3: Local machine. #

  1. Add the remote repository as origin repo to to your existing local git repo.
  2. Get the local master branch to track the remote branch.
  3. Then push to the server:
git remote add origin user@server.com:/~/myrepo.git 
git push --set-upstream origin master

You can now also clone the server repo elswhere by the usual git clone command

git clone user@server.com:/~/myrepo.git

Further pushs and pulls can be done simply by call git push and git pull (origin master is not needed).

git add .
git commit -m "update message"
git push

It wll probably ask for user and password for the remote server if you are not using SSH keys to communicate with the server.

There are probably more elegant ways of doing it. Let me know what you think. Drop me a line .