Lady bug and fairy sighting on a warm November day in Atlanta.
I’m writing this post for friends that I work with on projects that need a simple guide to using git. The overall process consists of installing git on your system, generating ssh public and private keys, sending me your public key, cloning the git repository (repo), and working within the repo. Let’s get started!
For Windows / Mac OS X you can just download and install binaries: http://git-scm.com/downloads.
If you are using Ubuntu, open a terminal and enter:
$ sudo apt-get install git
If you are using Mac OS X and you would like a better package manager, you can install macports. Then install git with the command:
$ sudo port install git
Generate your ssh keys
Open a terminal, if you are using a Windows git binary, open the “git bash” program, and enter the following:
$ ssh-keygen -t rsa -C "email@example.com"
The ssh-keygen program will prompt with you several questions / options. You will need to provide the output location for the keys (should be the .ssh folder of your home directory) and a passphrase to lock your private key. Remember the passphrase because it will be used to unlock your private key when you clone, push, and pull from the repo server.
Generating public/private rsa key pair. Enter file in which to save the key (/path_to_home/.ssh/id_rsa): [Hit Enter] Enter passphrase (empty for no passphrase): [Enter a passphrase] Enter same passphrase again: [Re-enter your passphrase]
The keygen program will generate your public key (id_rsa.pub) and your private key (id_rsa) in the .ssh directory that you specified above.
Open the id_rsa.pub file with a text editor, copy the contents of the file, and send them to me (your repo server administrator) in an e-mail. I will add your public key to the authorized_keys file on our git server. If you want a quick way to print out the contents of the public key file to the terminal, you can use the concatenate command.
$ cat ~/.ssh/id_rsa.pub
Then just copy the string that was printed and paste it into your e-mail client. Remember, your private key is private! Don’t send it to me.
Clone the git Repo
I will provide you with a URL / directory location of the git repo in the form: firstname.lastname@example.org:/opt/git/myproject.git. Just use the git clone command to grab the git repo.
$ git clone email@example.com:/opt/git/myproject.git
Change into the git repo’s directory:
$ cd myproject
See what’s in the project (probably files and directories):
The workflow consists of updating the git repo to the newest server version, modifying the files in then project, staging the files for commit, and then pushing your changes up to the server. Rinse. Repeat.
Get the updated server version / pull down new changes (assuming you are in the git project’s folder now – you already ran “cd myproject”):
$ git pull
Now you can do some actual work! Edit files, move files, delete files, add files. Remember that git doesn’t keep track of folders, just files. That means if you create an empty directory, it won’t be uploaded to the server. You need a file in that directory.
Take a look at what has changed:
$ git status
Include changed files in the next upload:
$ git add <filename>
Commit changes to your LOCAL repository:
$ git commit -m "enter some sort of meaningful message here about what you just did in the project"
Push your changes up to the server:
$ git push origin master
You need to include the “origin master” the first time you push your changes, but after the first time, you only need to enter the command:
$ git push
To recap, the command workflow is:
$ git pull # edit files$ git status $ git add <filename> $ git commit -m "some sort of message" $ git push
It is often a good idea to not include automatically generated or “build” files in the git repo. If it’s a file that is automatically generated when you run your build command, don’t include it! Try to keep your git repo lean, including just the minimum number of files that are needed to generate the final output.
Committing Multiple Files
You can add multiple files to the local commit by appending the git commit command with “-a”
$ git commit -a -m “some meaningful message”
Deleting Multiple Files
A useful command to remove files from the git repo that you deleted manually is:
git rm $(git ls-files --deleted)
A lot of people use homebrew to compile pianobar on the Mac. Here is how to compile pianobar using macports.
1.) Install macports: http://www.macports.org/install.php
2.) Open up a terminal and install system dependencies with macports:
$ sudo port install libgcrypt gnutls json-c ffmpeg libao wget
3.) Create a clone of the pianobar git repo. I prefer this method because it will allow you get updates as the pianobar / pandora folks fight each other.
$ git clone https://github.com/PromyLOPh/pianobar.git
4.) Build and install:
$ cd pianobar
$ sudo make install
5.) Setup configuration file.
$ mkdir -p ~/.config/pianobar
$ cd ~/.config/pianobar
$ wget https://raw.githubusercontent.com/PromyLOPh/pianobar/master/contrib/config-example
$ mv config-example config
Then, just open the config file with your favorite editor (probably emacs) and replace “firstname.lastname@example.org” with your Pandora user name and enter your password. Make sure to remove the pound-sign comments in front of the user name and password lines. Here is an example of what the lines should look like:
user = email@example.com password = mysupersecretpassword
6.) Test pianobar
1. Install dependencies:
$ sudo apt-get install libgd2-xpm
2. Download source code from sourceforge: http://sourceforge.net/projects/gnuplot/files/gnuplot/4.6.5/
Download the tarball gnuplot-4.6.5.tar.gz
3. untar it:
$ tar xvf gnuplot-4.6.5.tar.gz
4. Configure, build, and install.
$ cd gnuplot-4.6.5
$ sudo make install
$ sudo ldconfig
5. Test it.
$ gnuplot --version
"gnuplot 4.6 patchlevel 5"
I needed a wooden hammock stand for a cotton hammock I purchased online. I decided that this would be a good project to learn how to use SolidWorks to first design the hammock stand before constructing it. I searched around online for various designs, took pieces from designs that I liked, and put this design together.
… and here is what it looks like after I 3D printed it…
Caveat: I’m a 3D printer.
Mira and Jenn are brewing kombucha in our kitchen, but they need a way to track the last time they filled it up with water / sugar. So, Mira asked me to make her a chalkboard for the kitchen.
The surrounding wood is made from pallet wood I found in the trash. The back plate is thin plywood that I also found in the trash. I put a layer of natural wood stain and two layers of polyurethane finish on the frame. The chalkboard was created with spray paint chalkboard.
I bought a bottle cap opener from the Sweetwater Brewing Company a few months ago and finally got around to mounting it on a nice piece of wood. I routed the edges, routed the back to install hidden magnets, sanded it, and finished it. It looks nice in our hallway.
I finally got around to taking photos of a couple of projects off of my DSLR and uploading them onto my computer.
This is a bandsaw box I made for my niece for her birthday.
I’ve had this 4′ x 1′ mirror for years since my friend left it at my apartment when he joined the army. It’s had a permanently broken frame, so I decided to finally make a nice frame for it and gift it to my girlfriend for her birthday. I was able to use my new Bosch router to add nice curves to the edge of the mirror as well as the drop in area in the back where the mirror rests on the frame.
My tools are now off the ground! Check out my pegboard project.
I decided that I severely lacked basic woodworking skills in my life. Thus, I read blog posts on woodworking, watched Youtube videos of people building wooden objects, and purchased three power saws: a circular saw, a miter saw, and a jig saw. It’s like Keanu Reeves learning Kung Fu in the Matrix… but in real-time.
My first project is a somewhat basic one, but essential (from what I’ve read on the internet) in any carpenter’s wood shop. I decided to build two sawhorses. I found a tutorial on building sawhorses at the http://woodgears.ca/ website. The woodgears website has tons of great plans for woodworking and carpentry projects. The woodgears guy uses Google Sketchup most of the time to lay out his plans. I decided to go with Blender for CAD drawing because of my unhealthy obsessive compulsive need to use open source software and the fact that I haven’t used a good pure open source CAD program like FreeCAD (more on this another day).
Here are some photos I took during the construction process…
… and here are the photos of the completed sawhorses…
The plans from the woodgears website were easy to follow. I would highly recommend them to anyone who is just starting their adventure into woodworking.
… now if I could only understand the difference between woodworking and carpentry…