Next in my quest to move my website design to a more professional workflow is using version control more thoroughly.
For me this means getting to grips with a little app that I’ve been avoiding for a few years – GIT!
So what’s my goal….
Basically I want a local development server that links to a remote ‘live’ server – giving me the ability to test content and develop apps, whilst being able to go back a few steps and branch my development.
This post will track my first attempt – so I’ll probably tidy up things in a guide later…
As a first attempt I’m going to follow this guy:-
http://blog.woodylabs.com/2012/01/1and1-web-hosting-git-installing-it-for-singular-dev/
…and as this is a little bit of an experiment I’ll be attempting it first on the dev.galiquis.com section.
- Open SSH session
- cd to dev.galiquis.com root folder
- create two new directories:-
- …/dev/live (live site)
- …/dev/repo (git repository to store all the changes)
- Next create the local folder to develop in (part of the WAMP Server folder structure)
- right click in folder > select ‘git bash here’ > type ‘git init’
- Back to SSH
- Change directory to the repo directory > ‘cd ./dev/repo’
- type ‘git init –bare’ > message “Initialized empty Git repository…”
The next step is slightly different from the guide I’m following….
- ‘vim ./hooks/post-receive’ (opens vim with a blank new document ‘post-recieve’
- ‘i’ to insert text into the new file, typing:-
- #!/bin/sh
- GIT_WORK_TREE=”../live” git checkout -f
- ‘esc’ to exit insert mode > ‘:’ > wq (save and quit)
Next we need to make it executable…and back to the guide…
- chmod +x ./hooks/post-receive
### so far so good – but the next stage (establishing a SSH link) is causing problems ###
The solution to my SSH headache was turning to GUI tool – SourceTree
It was a simple install and when pointed at the local dev folder it piked everything up.
But the SSH issue…
- Tools > Options > General
- I took the opportunity to ad in my name and email in the global settings…
- set SSH Client to Putty/Pink – leaving the tick in Auto start SSH agent > ok
- Tools > Create or Import SSH Keys
- I decided to create a new key…
- Click ‘Generate’, then move your mouse randomly while it generates a key for you
- Once created I saved private and public versions in my user folder
- Tools > Options > General
- SSH Client Configuration > SSH Key > navigate to, and select the new private key > ok
Thats the key configured, now the connection
- Still in SourveTree > ‘Settings’ > ‘Add’
- ‘Remote name:’ > enter an identifier name
- ‘URL / Path’ > ‘ssh://[username] @ [host] / [remote repo folder]
- ‘Host Type’ > Unkown > ok > ok
Finally test the connection using ‘push’…password entered and it all works 🙂
Peace
G