Thursday, March 24, 2016

Setting up an SSH Git server on Windows...


I have a set of Raspberry Pis and I need to back up the stuff I do on them, and ideally add some version control as that is always good.
So the idea is to set up a git server on my Windows machine, giving me the ability to both version control the stuff I am doing, and back it up through the pre-existing Windows backup. And the assumption is that anything not in git can be recreated easily enough.
This and the follow up here are the best tutorials I've come across describing this, but full details here:

Install SSH

I'm using the new Microsoft supported OpenSSH.
  • unzip the package at C:\Program Files\OpenSSH-Win64 and follow the installation instructions.
  • Check the installation by connecting to the Windows machine through SSH.
Note that there OpenSSH isn't yet mature enough for this to work correctly. Worth instead using Bitvise SH Server which is free for limited use.

Install Git

  • Download git for Windows and install. Suggest install either git bash, or git bash + cmd option.
  • Update PATH to add C:\Program Files\Git\mingw64\libexec\git-core and C:\Program Files\Git\bin
  • Create a new file in C:\Program Files\Git\bin named gup.sh. his removes additional single quotes that are added by ssh from Linux to windows:
"C:/Program Files/Git/mingw64/libexec/git-core/git-upload-pack.exe" $*
  • Create a second new file named grp.sh:
"C:/Program Files/Git/mingw64/libexec/git-core/git-receive-pack.exe" $*

    How to use:

    To clone:
    git clone -u 'sh gup.sh' user@laptop:C:/Temp/new-project.git
    To push:
    git push --exec 'sh grp.sh' user@laptop:C:/Temp/new-project.git master
    To pull:

    git pull --upload-pack 'sh gup.sh' user@laptop:C:/Temp/new-project.git

    Alternatively, update ~/.gitconfig using (see here):
    git config --global remote.origin.uploadpack 'sh gup.sh'
    git config --global remote.origin.receivepack 'sh grp.sh'

    To create an empty project:

    On remote server:
    mkdir new-project.git
    cd new-project.git
    git init --bare

    On local machine:
    cd new-project
    git init
    git add *
    git commit -m "Initial commit"
    git remote add origin user@laptop:C:/Temp/new-project.git
    git push origin master

    To set up Public Key Authentication

    On remote server (linux):
    ssh-keygen –t rsa
    or (Windows):
    ssh-keygen.exe -t rsa -f id_rsa

    (For OpenSSH) Copy the contents of ~/.ssh/rsa_id.pub and add to %systemdrive%\users\user\\.ssh\authorized_keys on host.


    Alternatively...

    Use Bitvise SSH Server as it is better...

    Monday, October 05, 2015

    X11 forwarding...

    Easiest way is to use Putty and Xming.

    Have tried Cygwin/X, but seems overly complex: Xming appears to be the simpler answer.

    Just need to make sure X11 forwarding is set on Putty, and everything else should just work...

    Monday, August 03, 2015

    Windows 10 and MS Money...

    ...don't seem to work together: Money fails with an error stating it expects IE6.

    The initial solution appears to be to update the registry with the following, which seems to work:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer]
    "Version"="9.11.10240.0"


    The full thread can be found here.

    Monday, April 21, 2014

    Getting the new Dell Working...

    Lovely computer, but would prefer if it had worked out of the box!!

    Flickering screen on batteries is fixed by switching off Display Power Saving Technology on Intel HD Graphics Control Panel (see thread here).

    Then the laptop not coming out of sleep is ironically, the Intel Rapid Start Technology. This needs to be switched off...!

    Sunday, April 20, 2014

    Source Code Pro...

    Currently enjoying the Source Code Pro font, which can be downloaded from here: the OTF version is the newest font type...

    Note to stop xterm opening with cygwinx, type touch ~/.startxwinrc in the bash terminal. See here

    Wednesday, August 07, 2013

    Setting up the Slide Scanner

    Always manage to struggle with this one, but you need to:

    • Connect scanner and power on before powering on PC
    • Install Hamrick Vuescan (free update period has ended, so stick with version 8.4.60) including the provided drivers
    • Unpack SCSI drivers (aic78xx_aic78u2_vista_x86_v605456.exe)
    • Through Device Manager, locate the SCSI card, and install the unpacked drivers
    • Register Vuescan, using the details in .\Assorted Stuff\Vuescan Account Details.pdf
    And it should all work well, although the SCSI card appears to conflict with the sound card for some reason...

    Friday, August 02, 2013

    Could not resolve host: mirrors.fedoraproject.org; Name or service not known...

    In VirtualBox. Turns out it is easy to fix...

    [root@localhost ~]# vi /etc/resolv.conf
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    [root@localhost ~]#

    However, this file is auto generated by network-manager, so you need to add the following to the appropriate /etc/sysconfig/network-scripts/ifcfg-* file:

    PEERDNS="no"
    DNS1="8.8.8.8"
    DNS2="8.8.4.4"

    And restart the network manager:

    [root@localhost ~]# systemctl restart network

    Should all work perfectly...

    Sunday, May 20, 2012

    IP Addresses and Computer Names...

    I couldn't ping a computer name, just an IP address. And the internet (in its wisdom) posted a fix here.

    Update /etc/nsswitch.conf to add "wins" to the line "hosts:"

    And you also need to install samba, samba-common and samba-winbind...

    Wednesday, February 01, 2012

    Chrome SE Linux fix...

    From here:

    # cat /var/log/audit/audit.log | grep chrome | audit2allow -m local > local.te
    # make -f /usr/share/selinux/devel/Makefile
    Compiling targeted local module
    /usr/bin/checkmodule: loading policy configuration from tmp/local.tmp
    /usr/bin/checkmodule: policy configuration loaded
    /usr/bin/checkmodule: writing binary representation (version 10) to tmp/local.mod
    Creating targeted local.pp policy package
    rm tmp/local.mod.fc tmp/local.mod
    # semodule -i local.pp

    Sunday, November 20, 2011

    Colours...

    Not an interesting post by any means. However, as an aide memoir, it is probably a good idea to write down the colours we've used so far in painting the house, so we can repaint them when the kids get creative with their crayons:

    Living Room: Almost Oyster and Muddy Puddle
    Smaller Bedroom: Natural Hessian
    Front Bedroom: Amber Spirit (Light and Space)