Tag Archives: github

Setting up multiple SSH profiles with Github


I recently had to setup multiple SSH profiles for Github. The reason why I had this requirement as my work required me to have a Github account outside of my personal account. The machine I am using is used for both work and personal development. I needed both SSH keys to work. I had never ran into this before as I never had two Github accounts. Since you are not able to use the same ssh key between multiple accounts in Github I had to come up with a way for both to work together. This makes sense for security purposes that the key should only be identified with one account. The process to set this up was pretty simple overall but that is after you understand what you need to do. Understanding exactly what is needed can be tricky at least from the documentation I found online.

The first thing you need to do is create a SSH key pair for both your personal account and work account. They should be using different email addresses.

$ ssh-keygen -t rsa -C "your_personal_email@youremail.com" # follow prompts use defaults if you want

$ ssh-keygen -t rsa -C "your_work_email@youremail.com" # specify new name for key

After that is done you should have a couple of keys. For example you could have id_rsa and id_rsa_work or whatever you called them. Add the proper SSH keys to your Github accounts following Generating SSH Keys – Github. The documentation there is really well done so no further explanation is needed.

So now you should be able to use each SSH account by adding it. Everything will work at this point but you will have to keep adding the ssh-add when you switch between accounts. If you don’t switch often this may be fine but it’s a really pain if you switch often. Also you tend to forget overtime why it’s broken all the sudden.

ssh-add ~/.ssh/id_rsa

The next step is you need to create an SSH config to handle the multiple accounts.

sudo vim ~/.ssh/config # add in the hosts

# Inside the file add the following

Host github.com-personal
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_rsa
Host github.com-work
    HostName: github.com
    User git
    IdentityFile ~/.ssh/id_rsa_work

Save and close it out and that part should be all set. The next part is the most critical. If you have an existing repo go and modify your SSH string to add in the -work or -personal. This is whatever you named your host. Here is an example for my personal project.


If you are adding a new clone or new remote continue to use the same host name you set in your SSH profile. After you run the process it all makes sense it looks at the ssh config to determine which key to use.

Github Reliability Now

I made a post a while back about Github Reliability and how I thought it wasn’t so great. Since that post I don’t think Github has been down. If it has been down it has been down very little and not noticeable in the everyday work environment. I have been very impressed by this. The reason why this post is coming up as over the last year I noticed Github being down often enough to notice. It seemed to happen right in the middle of the work day to.

I believe they have made great effort to improve their reliability. This could be a sign that they turned the corner and are now able to keep their service up and running at all times. Which is very impressive to me. See that they were having so many issues over the summer they have really turned it around. I feel it’s only right to post the good as I did post about the bad some time ago.

Github ProTip

I recently noticed that Github changed their interface. They did a great job at making it faster and it actually looks more appealing. At least to me. I also noticed with their updates they added something called a ProTip at the bottom right before you make a comment.

If you see the attached image you will see what I am referring to. I think ProTip is a term that has just come up and is already being over used. I feel that if you use that term you are saying you are better than everyone else on that subject. You are considering yourself a pro. Which is fine but why do you have to tell me your a pro. If your really a pro won’t the context of what your saying be take as such. What’s the point in adding this on to a statement. I won’t read it unless your a pro. Also if you add ProTip in front of what your saying there is less of a chance of me reading it. Now every time I have to make a Github comment I get to see ProTip.



Github Reliability

I have been using Github for work for the last couple of years. I have noticed that their service has been getting less and less reliable throughout the years. They are the leader when it comes to Git hosting. So it’s hard just to turn them off completely at this point. Plus I am using it at work so I don’t have much say in moving off of it. It’s sad to see it as overall their feature set is really good. They have been very innovative throughout the years. I have been very impressed by their pull request feature and many more. I have also been impressed by how easy they make Git. Saying that they have their own set of issues you have to deal with on a monthly basis. I have noticed more and more that they go down often.

It seems that at least once a month Github will go down for a small time period. This can range from a couple of minutes up to ten or so minutes. It’s never hours of downtime. They seem to respond to the issue fast and get it fixed. I feel that most downtime can be avoidable or should be worked at so it is avoidable. We don’t see Google services go down once a month. In the last couple of years I haven’t seen any Google services  I use to down at all even. Yes in the technology world unexpected things happen from time to time but it shouldn’t be every month. I think Github has forced us to at least think about other hosting providers.

One name that comes to mind is bitbucket. It seems that their feature set is also very rich but they may not have as many downtime issues as Github. I have never used their service but it seems to be gaining in popularity. I really hope to see Github be able to get it together but if not companies are going to have to start thinking about using other Git hosting solutions. It’s also possible to roll your own Git server but of course you won’t get all the rich features of these service platforms.

To be clear right now the best Git hosting service is Github. Even if it goes down a couple times a month. The intention of this post wasn’t to bash Github. I do feel they work hard to keep their service up. I just feel that some of their downtime could be avoided. That is of course without knowing their infrastructure.

Automating simple tasks

When I first started my development career I was nervous about scripting things. I felt that if I wasn’t using some sort of GUI tool I had a higher potential for error. So I was afraid to automate my tasks even the most simple ones. I thought the risk wasn’t worth the reward. I thought if it only takes me a minute each time to do that task why would I spend more than that time creating an automated script. As I gain more experience in my career my view has changed on this. The turning point was only a couple of days ago. Over the holiday break I read The Passionate Programmer: Creating a Remarkable Career in Software Development (Pragmatic Life) and it really opened my eyes that everything we do over and over again should be automated. Not only tasks that take hours but even simple tasks that could take only a short period of time. So I started automating some of my work tasks. These are tasks that I repeat over and over again.

The first task that I automated was creating branches for Github. I found myself doing something similar to this over and over again.

git remote update; git co -b [ticketId]_description upstream/[branch]; git push [repo] [branch]

This process would only take me a little bit of time. I had never thought about automating it because the time it took wasn’t very long. After reading the book I decided to give it a try to see if it made it easier or faster. It turns out that I now save over half the time per branch creation. It may not seem like a lot of time at first but when you do it multiple times per day it adds up.

After I automated that process I thought what other tasks do I do over and over again that could potentially be automated. At my job we create pull requests for each branch when it’s ready to be merged. We use Github so the process that I was following was to go up to Github and use the GUI provided. Well it turns out that Github has an API that is very easy to use. So I created a automated script for creating pull request’s. Now instead of it taking me a minute or more to create a simple pull request it takes around 10 seconds. Again the time savings adds up. For example most days I will create up to three or more pull requests per day. You can see how the time saved really adds up.

I wasn’t satisfied with that level of automated. So I decided to take it up another level. Each pull request we create we then need to turn around and go down to our ticket tracking system and put that pull request link in there. We use PivotalTracker for ticket tracking. Well that seems like a tedious task especially since I am already using the Github API to create the pull request. So I added that to my automated process. So now to make a pull request and update the ticket status I can do so in around 10 seconds. This allowed me to cut the whole process pull request to updating the ticket to be under 15 seconds. What use to take me more than a minute now takes under a half of a second.

The point of this post is that automating even the simplest of tasks is important. It can make a huge difference. My thought process now when I get a new task is how can I automate the tedious part of the task. That way I can spend more time dealing with complex issues that are not able to be automated. If you are new to automation I would start with something simple. Don’t try to automate your entire process through one script. Possibly create multiple smaller scripts so you can do it over time.