My partner posted our code on Github and I am now being investigated for cheating. What to do? Last year I took a class where we had to work with a partner on programming assignments.  Apparently someone's solution from this year has a 50% match with our solution from last year.  I did not share my code with anyone but I would not be surprised if my partner did.  What should I do?

Edit: I just talked to my partner and apparently he posted the code on Github so he could show a professor his previous work.  But then he deleted it later.

Update: We talked to the professor and he says my partner and I will not get in trouble.
I am sometimes involved in panels that investigate unfair means. I am also in the position of checking my own students' code for suspected plagiarism, often by comparing code from a large pool made from the current and past submissions. There are several tools that assist with this, such as Moss and JPlag.  I have experience with both these but there are others, and some that academics have made for themselves for local use.

It is quite possible, therefore, to get a match between a current student's submission and a previous student's submission without the lecturer or university knowing how that occurred. All they can do in this situation is to convene an investigation to determine the facts. Often these investigations are formal affairs, mainly to protect the interest of the students concerned and to ensure that the decision makers are impartial.

This is highly likely to be the position you are in. At the moment they do not know how another student came in possession of your code. If the investigation is organised properly you will be given the opportunity to explain your position, just as you did here. Most investigations should allow you to submit written and verbal statements. You should ensure you do this. I also suggest you seek advice from others who can assist you locally, such as a students union or student association or other student advisor. They will have assisted other students in the same position as you before and help you make the best of the procedure that you have become involved with.

Although it may not be your fault, at the moment the university does not know this. Help them to understand.