Using Multiple SSH Keys with Github

May 20, 2015

via http://www.freshblurbs.com/blog/2013/06/22/github-multiple-ssh-keys.html#tldr


Since Github doesn't allow us to reuse an SSH Key, the only sane solution is to jump through some hoops and generate + use multiple keys on the server itself. Let's look at some effective approaches of doing that.

Short version: define multiple hosts in the SSH config file for each repository, which use different SSH keys, then you can assign different deploy keys to each repo. But read the whole article for the full details.

Moving files between git repositories, preserving history

April 17, 2015

I needed to copy a directory between two git repositories while preserving its history. I found some good instructions at http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/, which got me started, but I figured out a way to avoid having to move all the files into their directory again (lines 5-6 in Greg’s instructions) by reversing the filter to remove everything I don’t want instead of only including the directory I want. Here are the steps (the idea is the same as in Greg’s post, so please read that to get the explanation, I’m only listing the commands here for reference):

Three levels of GIT config

April 17, 2015

via http://www.codinginahurry.com/2011/02/05/three-levels-of-git-config/

Very nice explanation, via coding in a hurry
There are 3 levels of git config; project, global and system.
      • project: Project configs are only available for the current project and stored in .git/config in the project's directory.
      • global: Global configs are available for all projects for the current user and stored in ~/.gitconfig.
      • system: System configs are available for all the users/projects and stored in /etc/gitconfig.
Create a project specific config, you have to execute this under the project's directory.
git config user.name "John Doe"
Create a global config
git config --global user.name "John Doe"
Create a system config
git config --system user.name "John Doe"
And as you may guess, project overrides global and global overrides system.