Version control is a veeery nice way to keep track of one's work. As a bonus you've got backup automatically and you can trace when the major fsck up has happened. Code base versioning is a must in my honest opinion. However plain-text versioning can work as well and as I'm moving further and further towards text-only computing it is natural step forward to do it also.
I've got a little catalog of text notes, passages etc. that I was storing on my VPS for some time now. I accessed this catalog from different computers (all in my total control, hence secure connection over SSH there was) to note stuff. It is far from perfect as I needed stable internet connection to do so. Of course in a big city it's not really a problem. However internet connection also means lots of distractions!
Solution to this problem I'm trying out is setting up a GIT repository on my VPS that later on can be cloned, versioned and merged after doing my work locally without said distractions.
- Server with administrative privileges.
Git installation and configuration
Note: I'm having Debian VPS so all instructions will be noted with accordance to this system.
$ sudo apt-get install git
git user and configure it to use git-shell by default:
$ sudo useradd -m -d/home/git git
$ sudo echo '/usr/bin/git-shell' >> /etc/shells
$ sudo usermod -s /usr/bin/git-shell git
$ sudo su -s /bin/bash - git # use /bin/bash explicitly as we default to git-shell for security
$ mkdir git-shell-commands
Grant access to trusted computers
Do not forget to add your ssh keys to git's user
Create local bare repository
We need to create bare repository in git's home catalog. Bare means that it will only store git objects, so we can simplify this as server-side part of repository.
$ sudo su -s /bin/bash - git
$ mkdir REPONAME.git
$ cd REPONAME.git
$ git --bare init
Add remote to local repository, push and get to work
After all this work we can create repository locally, add our newly created bare repository and begin normal git workflow:
$ mkdir REPONAME
$ git init
$ git remote add origin 'git@SERVERNAME:REPONAME.git'
May the open source be with you!