Tuesday, February 13, 2018

Setting Up Rasberry Pi as a git server



I had a Raspberry Pi that I bought a long time ago when it just started getting some notice. It was used for a little bit as a media server but was quickly replaced by a PlayStation 3 for that purpose. Its been sitting in my drawer for years. I finally dug it out today as I needed a private local git server for upcoming projects. Everyone else is making robots and plant water-ers out of their pi's but this will do for now. 

My steps (very easy)
  1. I followed the setup at here. The first step is to download NOOBS(New Out Of Box Software. Alternatively you can just install Raspbian but NOOBS contains Raspbian and is easier to setup for beginners. Start the download first thing since it is 1.5GB. It took about 25 minutes to get it downloaded.
  2. I'm using Linux and went through the directions to format my SD card here, but in the end after I formatted I wasn't able to mount so I ended up using gparted instead to reformat the card into Fat32. Raspberry Pi doesn't recognize any other file format type.
  3. Plug in the SD card to the Raspberry Pi and start it up. Select Raspbian from the menu and install. This will take awhile.
  4. When it boots up put on finishing touches of booting to CLI and turning on ssh. (My Pi is the original Model B without wifi so I'll leave it plugged in to a ethernet cable in a different room). 
  5. Then its pretty standard to install git 
    1. sudo apt-get update
    2. sudo-apt-get upgrade
    3. reboot
    4. sudo apt-get install git-core
  6. That's pretty much it. You can start setting up repos.
To do that 

ssh to git@raspberrypi

mkdir 'repo.git'

Back on the laptop:

 git init
 git remote add origin git@raspberrypi:/home/git/repo.git