Configure Access to SourceTree to Gitorious Source Control

Overview:

  • SourceTree is a visual client to a git-style source control repository for Windows (in this example) and Mac-OS-X.
  • Gitorious is a wiki/git-style web based file browser and repo setup system like github – except YOU run it.  It is delivered as standalone computer (Virtual Machine) that hosts a git server and wiki all in one. The wiki is integrated into the project. My good buddy at Geek Inc. delivered this all on a 4GB stick which had a VMWare AND a VirtualBox version of it and then he and pointed me in the right direction. Thanks Ben.
  • IMPORTANT – EVERYONE ELSE CAN VIEW PROJECTS PUBLICLY WITHOUT WRITE ACCESS (awesome!) – meaning they don’t have to know git – just send them links to the relevant directories or files AS A WEB LINK – they don’t have control over your files since the files are stored on the Virtual Machine’s internal directory structure. They can make their own accounts – but the admin determines who is on what team for write to the repository. THAT WAS THE GOAL
  • Ideally there should be a tracking # for each branch that is created – this could be tracked here on Sharepoint or elsewhwere. Each branch should be named MM-XXXX where MM is shortcode for a project and XXXX is a number for each feature, bug, request etc.
  • Because we are using https (note the s) this means that data to and fro from our client to the git server (called gitorious) is encrypted, a couple of computer security certificates need to be generated and installed. If you have your own certificates and the conform to the openSSH format, you need them run through a tool called “puttygen” and make the putty compatible and install them into a paegent – which should be installed automatically alongside the sourceTree download. This is all done step by step below – so don’t fret.
Download and install Atlassian’s SourceTree
Configure your computer to know where to find the computer
  • start notepad.exe from the Start button’s search window
  • open file called c:\windows\system32\drivers\etc\hosts
  • append these lines to it (or adjust them if there are items with gitorious-ce-va.localdomain)
    • 10.34.0.169 gitorious1.focusdev.local
      10.34.0.169 gitorious1.focusdev.local
  • Save the file
  • Test if it is working and you have access by going to the webpage http://gitorious1.focusdev.local
    • there are warnings about the certificate – it is ok to proceed. To avoid these warnings, you can install the certificate
    • Internet Explorer
      • in the URL bar, you will see in red “Certificate Error” – click on that, and choose View Certificates on the bottom of the popup
      • this will then show an Install Certificates – follow the steps and accept the defaults to install it
      • this should reduce the “spam” you get when you go to that site
      • what is this doing? It is essentially telling your computer, that the free non-payed-for certificate is ok. This certificate helps encryt/decrypt traffic from your browser to this Gitorious webpage- which if you look has an https as a prefix – meaning that the data is encrypted and not sent as plain text. Internally – this is not important but if you are doing this over the internet or using other people’s servers – you prefer this for personal or company data

Request a Gitorious username and password

  • if the repo is public – this does NOT mean that you have collaborator access
    • ask to be part of a design group and that this group is a collaborator

Configure your SSH key

  • until I write a litte more – there is a link online that helped me do this.
  • NOTES:
    • there is a menu item in SourceTree (Tools->Create or import ssh keys)that automatically starts puttygen.exe so you don’t have to download it
    • you also don’t have do download paegent.exe AND it is already running – as it is in you system tray (those little icons on the bottom right of your start bar at the bottom- click the little up ^ arrow to the right of the visible system tray icons and you will see more icons hidden from normal view – this is where paegent.exe already running (blue guy with a hat)

If you already have repo – you can simply add a new remote – the gitorous remote – can lets

  • get a tab open in SourceTree of the repo you wish to add a new remote to.
  • Right mouse click on Remotes and choose New Remote
  • Click Add button
  • Lets name the remote “gitorious” to differentiate it from any existing remotes
  • the URL path:
    • this is a copy/paste from the Gitorious webpage for the repo that you have been given access to
    • TODO: delete this after test complete: The electrical study project repo for example, would be git@gitorious1.focusdev.local:electrical-study-autoplant-project-testing/electrical-study-autoplant-project-testing.git
  • press OK. If you click Default remote – you cannot give a custom name. As new repos are created and we standardize on things, the default origin is ok. We only need a renamed remote while we already have one called “origin”
  • ASIDE: To edit these settings once they are made, use the menu item “Repository->Repository Settings…”
  • Testing: Try to fetch from the gitorious remote repo
    • Right mouse click on the new gitorious (under Remotes) and choose Fetch from gitorious
    • click the little checkbox show output and you should see some positive confirmation
  • Testing2: Try to push to the repo if that is appropriate and you feel you can.
    • Right mouse click on the new gitorious (under Remotes) and choose Push to gitorious
    • click the little checkbox show output and you should see some positive confirmation

Advanced:

Initial Install headaches

  • if you are using the VMWare (VM Player) remember – Ctrl-Alt releases your mouse.
  • you have to configure your new VM to get an ip address properly. Follow the steps below
  • log into the VM. The username is root and the passwork is g1torious. You might want to change it if it is on a public network. This password came from gitorious’ Virtual Appliance set up page
  • delete the network card config file and reboot. It seems like reckless but be assured it will rebuilt itself
    • [code]
      rm /etc/udev/rules.d/70-persistent-net.rules
      shutdown -r now
      [/code]
    • If you feel nervous – that makes sense but just do it anyways and live dangerously
  • Edit the network file with an editor like vi which exists on the VM (no pico or emacs!)
    • [code]
      vi /etc/sysconfig/network-scripts/ifcfg-eth0
      [/code]

      you might need this webpage to help know all your options – here is what I had to get this going

      [code]
      DEVICE=eth0
      BOOTPROTO=dhcp
      ONBOOT=yes
      [/code]

  • and afterwards it changed to a static ip to something like
      • [code]
        DEVICE=eth0
        BOOTPROTO=none
        ONBOOT=yes
        GATEWAY=10.2.17.1
        DNS1=10.2.17.15
        DNS2=10.2.17.16
        NETMASK=255.255.255.0
        IPADDR=10.2.17.29
        USERCTL=noroot
        [/code]

Install tweaks

  • change default mode to public so people at focus can get to the files without needing the admin to set up a username and password. They can make their own accounts.
    • instructions at: gitorious install / configure site
      • command was[code]vi /var/www/gitorious/app/config/gitorious.yml[/code]
      • then edit public_mode:false to public_mode:false and save & quit file
      • then the host name gitorious_host=gitorious1.focusdev.local was changed (and is consistent with the rest of this article)
      • then the default email address was changed – the line gitorious_support_email=<your email here> was changed
      • restart with command:[code]
        /usr/bin/restart_gitorious
        [/code]
  • It might be nice to have a DNS entry added to the list of ip addresses (instructions for windows 2008 R2) and a static ip address set aside for this (instructions for windows 2008 R2)