When you need to work with more than one account on GitHub you’ll need to get a little creative. This situation usually arises when you want to keep your personal account separate from your work account. The process is fairly straightforward and involves exercising SSH.
So, given that your existing SSH keys are your personal ones we’ll make the second set for work.
Create a New SSH Key
Create a new SSH key to use for the work account
You can also use -t dsa, if you do, replace all references to rsa with dsa.
Be careful NOT to overwrite your existing SSH key. Give this new key a unique name, e.g. ~/.ssh/id_rsa_WORK.
1
$ ssh-keygen -t rsa -C "your-email-address"
Add a new SSH key entry to your GitHub account by copying and pasting the contents of ~/.ssh/id_rsa_WORK.pub into the SSH key field of your account.
If you are running an authentication agent you will need to add this new SSH key to it.
1
$ ssh-add ~/.ssh/id_rsa_WORK
Edit the SSH Config File
If you do not already have the file ~/.ssh/config create it and add something similar to the following
1234567891011
# Personal
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
# Work
Host github-WORK
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_WORK
Sample Usage
In a nutshell, use the Host entry in your SSH commands instead of the actual host and SSH will use the correct information. For example, the following will use the new identity key.
Uncomment it (remove the leading ‘#’) and save file.
Put memcache.php in ~/Sites/. To hit it
1
http://localhost/~<username>/memcache.php
memcache.php has a username/password setup
12
username: memcache
password: password
Windows
If on Windows and not running Apache take a look at WAMP. In either case drop the PHP file in the appropriate place.
Telnet Debugging
For telnet to memcached
1
$ telnet localhost 11211
Quick overview of the most useful telnet commands
12345
> stats #lists a bunch-o-stuff
> stats items #lists the slabs, example output. STAT items:3:number 1
#list the items in slab id 3 up to 100 items (doesn't seem to work if you leave off the last number, although it can be any number)
> stats cachedump 3 100
> version #version of memcached
This is the process to migrate an SVN repository to a Git repository. Adjust paths to your particular scenario.
Create a Git repository, but do not add anything to it. It must be bare. For example, if on GitHub do NOT add any ignore or readme files.
It is IMPORTANT that you do NOT go through the steps to clone the newly created repository or add anything to it. We are going to import the migrated SVN repository into it.
Now we need the SVN authors in nice Git format – store for safekeeping as it will be used later
To cover scenarios ambiguous scenarios add a ‘no author’ with an email of your choosing.
Somewhere safe make a temporary working area
1
$ mkdir temp && cd temp
Pre-prep the SVN repository (locally), this has some additional options as an example
12
$ cd /somewhere/safe/temp
$ git svn clone https://svn.example.com/svn/path/to/repo -A ~/authors.txt --no-metadata --stdlayout --no-minimize-url --ignore-paths="^branches" --tags="tags/releases" --tags="tags/ci-builds"
Create a bare Git repository
12345
$ cd /somewhere/safe/temp
# if already in the temp dir you can just use 'baremig.git'
$ git init --bare /somewhere/safe/temp/baremig.git
$ cd temp/baremig.git
$ git symbolic-ref HEAD refs/heads/trunk
Push the pre-prep SVN repository to the newly created baremig.git
1234
$ cd /somewhere/safe/temp/OHS
$ git remote add bare /somewhere/safe/temp/baremig.git
$ git config remote.bare.push 'refs/remotes/*:refs/heads/*'
$ git push bare
Rename ‘trunk’ to ‘master’
12
$ cd /somewhere/safe/temp/baremig.git
$ git branch -m trunk master
Migrate the SVN tags
12
$ cd /path/to/temp/new-bare.git
$ git for-each-ref --format='%(refname)' refs/heads/tags | cut -d / -f 4 | while read ref; do git tag "$ref" "refs/heads/tags/$ref"; git branch -D "tags/$ref"; done
Now go check it out. Once verified you can delete the local temp directory you worked from.
Tips, Tricks and Hints
SVN Command Line Error
If using the latest Xcode (version 4.6.2) and command line tools (/usr/bin/svn) with a Subversion version of 1.6.18 and you receive errors trying to check out the SVN repository
Go to Homebrew and install Subversion – use this svn (/usr/local/svn) instead of /usr/bin/svn – that is make sure /usr/local/bin comes before /usr/bin in your PATH
Git SVN Command Line Error
When running the ‘git svn’ command and it errors out immediately you probably have to update the Perl SVN::Core CPAN module
It will create ~/.cpan as root which can then chwon -R once done (I think it’s OK to remove it, though, but probably best to wait until everything is completed)
This is one manner in which to debug HyperSQL, there are others, but this is probably the most straightforward. Since HyperSQL runs in memory you must be in debug mode with a breakpoint set in your application.
The breakpoint MUST BE configured to just stop the current thread, otherwise the HyperSQL browser will lock up since all threads will be stopped.
Set a breakpoint in your application – make sure it is right after where you want to examine data
Bring up the code evaluation window for your IDE
Eclipse: Display Mode
IntelliJ: Evaluate Expression | Code Fragment Evaluation
Paste in one of the following and evaluate (the Swing one has a nicer UI)
You can also paste one of these directly into your test class, e.g. in a before method, a test method, etc, but that may mess things up for others if you commit the code
As long as you are stopped at the breakpoint the DB browser will remain. You can continue to other breakpoints, but if you reach the end of the debug session the DB browser will exit.
One alternative is to run HyperSQL in server mode, you’ll still need to be in debug mode with a breakpoint in your application, but the advantage is you can use your DB client of preference to attach to HyperSQL. The connection string would look something like this (adjust accordingly)