Local Shared Repository
Date: February 6th 2016
Last updated: February 6th 2016
I have a laptop and desktop computer connected on the same network (TP-LINK ac1900 modem/router). I have also just plugged in a usb stick to store python scripts.
The idea here is to create a local git repo on this usb drive so that I can update my own file sharing and add in a little version control. At the moment file sharing is done by email and version control between computers is non-existent!
Steps:
- setup router
- mount network drive
- initialize git repo
- add local git origin
- push commits to usb drive
1) setup router
I formatted the drive as NTFS and left the usb drive available to everyone on the network
Check that you can connect to the drive...
2) mount network drive
I followed a bunch of methods to access the usb drive, but the one that worked for me was to mount the drive in my home directory.
- create ~/tplink
mkdir tplink
- mount usb drive
# mount all content inside 'volume' to tplink directory
sudo mount -t cifs -o username=ray //192.168.1.1/volume ~/tplink
# enter password for username specified
# check it worked
ls tplink
#returns: photos music
3) initialise local repo
"Git doesn't care where a remote repo is kept"
# go to existing directory
cd ~/python/scripts/kivy
# initialise git if not done already
git init
# clone the directory to the usb drive
git clone --bare ~/python/scripts/kivy ~/tplink/kivy.git
# add the cloned directory as a remote repo location
git remote add tplink ~/tplink/kivy.git
# add, commit, push
git add .
git commit -a -m "initial commit"
git push tplink master