As a writer, I have many documents that need to:
- be backed up in a secure and redundant manner
- have their revision history viewable at any time
- sometimes be collaborated on by multiple authors
- remain private and confidential
The way that I have solved this problem (which is one way among many) is by running my own Git server on a cloud based Virtual Private Server (VPS).
This is super easy to do using Linux, and these are the steps to facilitate it:
Note: Substitute the following placeholders with your individual values:
1. Secure your VPS using SSH
Please follow this guide to configure SSH on your VPS
2. Install Git
sudo apt-get install git
3. Create a repository on the server
git init --bare repository-name.git
4. Git usage
Clone the repository on the local machine
git clone ssh://firstname.lastname@example.org/~/repository-name.git
Make changes to your files..
This is done by using your favourite text editor or word processor. This is my minimal writing environment using Vim.
Then stage all of your changes
git add .
Commit your changes
git commit -m "Enter a descriptive message here about the changes you have made."
Push your changes from your local machine to the remote server
git push origin master
5. Reviewing your changes using git diff
Git diff traditionally compares files line by line. This is fine for programmers comparing source code files, but line-by-line comparison isn’t as useful to a writer as a word-by-word comparison.
This is the line-by-line result of running the standard
git diff command:
And this is the word-by-word result by running
git diff --word-diff=color