GitHub Inside Your Visual Studio

github visualstudio 24 comments suggest edit

I heard you liked GitHub, so today my team put GitHub inside of your Visual Studio. This has been a unique collaboration with the Visual Studio team. In this post, I’ll walk you through installation and the features. I’ll then talk a bit about the background for how this came to be.

If you are attending Build 2015, I’ll be giving a demo of this as part of the talk Martin Woodward and I are giving in room 2009

If you’re a fan of video, here’s a video I recorded for Microsoft’s Channel 9 site that walks through the features. I also recorded an interview with the .NET Rocks folks where we have a rollicking good time talking about it.

Installation

If you have Visual Studio 2015 installed, visit the Visual Studio Extension gallery to download and install the extension. You can use the following convenient URL to grab it: https://aka.ms/ghfvs.

If you haven’t installed Visual Studio 2015, you can obtain the installation as part of the installation process. Just make sure to customize the installation.

Customize install

This brings up a list of optional components. Choose wisely. Choose GitHub!

GitHub option

This’ll install the GitHub Extension for Visual Studio (heretofore shortened to GHfVS to save my fingers) as part of the Visual Studio installation process.

Login

One of the previous pain points with working with GitHub using Git inside of Visual Studio was dealing with Two-Factor authentication. If you have 2fa set up (and you should!), then you probably ran across this great post by Kris van der Mast.

I hope you don’t mind Kris, but we’ve just made your post obsolete.

If you go to the Team Explorer section, you’ll see an invitation to connect to GitHub.

GitHub Invitation Section

Click the “Connect…” button to launch the login dialog. If you’ve used GitHub for Windows, this’ll look a bit familiar.

Login Dialog

After you log in, you’ll see the Two-Factor authentication dialog if you have 2fa enabled.

2fa dialog

Once you log-in, you’ll see a new GitHub section in Team Explorer with a button to clone and a button to create.

GitHub Section

Clone

Click the clone button to launch the Repository Clone Dialog. This is a quick way to get one of your repositories (or any repository shared with you), into Visual Studio.

Clone dialog

Double click a repository (or select one and click Clone) to clone it to your machine.

Create

Click the “create” button to launch the Repository Creation Dialog. This lets you create a repository both on your machine and on GitHub all at once.

Create dialog

Repository Home Page

When you open a repository in Visual Studio that’s connected to GitHub (its remote “origin” is a github.com URL), the Team Explorer homepage provides GitHub specific navigation items.

GitHub Repository Home Page

Many of these, such as Pull Requests, Issues, and Graphs, simply navigate you to GitHub.com. But over time, who knows what could happen?

Publish

If you have a repository open that does not have a remote (it’s local only), click on the Sync navigation item for the repository and you’ll see a new option to publish to Github.

Publish control

Open in Visual Studio

The last feature is actually a change to GitHub.com. When you log in to the extension for the first time, GitHub.com learns that you have the extension installed. So if you’re also logged into GitHub.com, you’ll notice a new button under the Clone in Desktop button.

Open in Visual Studio

The Open in Visual Studio button launches Visual Studio 2015 and clones the repository to your machine.

Epilogue

This has been an exciting and fun project to work on with the Visual Studio and TFS team. It required that Microsoft create some new extensibility points for us and helped walk us through getting included in the new optional installation process.

On the GitHub side, Andreia Gaita (shana on GitHub and @sh4na on Twitter) and I wrote most of the code, borrowing heavily from GitHub for Windows (GHfW). Andreia provided the expertise, especially with Visual Studio extensibility. I provided moral support, cheerleading, and helped port code over from GHfW.

This collaboration with Microsoft really highlights the New Microsoft to me. When I pitched this project, our CEO asked me why don’t we ask Microsoft to include it. Based on my history and battle scars, I gave him several rock solid reasons why that would never ever ever happen. But later, I had an unrelated conversation with my former Microsoft manager (Scott Hunter) who was regaling me with how much commitment the new CEO of Microsoft, Satya Nadella, has with changing the company. Even drastic changes.

So that got me thinking, it doesn’t hurt to ask. So I went to a meeting with Somasegar (aka Soma), the Corporate VP of Developer Division and asked him. I’m pretty sure it went something like, “Hey, I don’t know if you’d be interested in this crazy idea. I mean, just maybe, only if you’re interested, it’s no big deal if you don’t want to. But, what do you think of including GitHub functionality inside of Visual Studio?” Ok, maybe I didn’t downplay it that much, but I wasn’t expecting what happened next.

Without hesitation, he said yes! Let’s do it! And so here we are, working hard to make using GitHub an amazing and integrated part of working with your code from Visual Studio. Stay tuned as we have big plans for the future.

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.

Comments

avatar

24 responses

  1. Avatar for Jan Van der Haegen
    Jan Van der Haegen April 30th, 2015

    This...
    This is awesome!
    Next steps of bringing that (and ES6/7 syntax support) to Visual Studio Code and I can imagine a large flock of non-MSFT developers making the switch!

  2. Avatar for Rion Williams
    Rion Williams April 30th, 2015

    This is such great news!

    While Github for Windows has been helpful, I've been looking for greater integration with Visual Studio and it appears my dreams have been answered!

  3. Avatar for Gabriel Porras
    Gabriel Porras April 30th, 2015

    And you will work for another platforms? I'd like this to be available for Bitbucket. Thanks

  4. Avatar for martijnhoekstra
    martijnhoekstra April 30th, 2015

    This is great. Time to try the git integration in vs again.

  5. Avatar for Kris van der Mast
    Kris van der Mast May 1st, 2015

    I don't mind at all. I'm actually glad it became obsolete and that you integrated your great platform into this great tool we all love. I'll check it out this weekend.

  6. Avatar for miguel delgado
    miguel delgado May 1st, 2015

    Hi Phil, great post and kudos for this, your video on C9 and your .Net rocks cast.
    All is great, the integration rocks, but I have a bit of a problem.

    If I clone a non VS solution project (like Angular or Angular Material) there is no VS .sln file or .cproj project in which case I can clone but I can't use.
    I can force my way by opening it as a web site and then creating an sln file pointing there but seems to me it defeats the purpose.
    What's to do in such case? How can I keep them integrated and in flow? Is even a way to do it?

    Thanks in advance.

  7. Avatar for Kiko
    Kiko May 7th, 2015

    Even in VS2013, Git is supported and does work with Bitbucket minus this new tight integration.

  8. Avatar for Abhay Kumar
    Abhay Kumar May 18th, 2015

    Thats Cool,

    Now VS can be used and no more hassles with source-tree.. It's great.

  9. Avatar for larsxschneider
    larsxschneider May 26th, 2015

    This integration is awesome! Do you consider a function to open a GitHub page from VisualStudio? Similar to https://github.com/larsxsch... ?

  10. Avatar for haacked
    haacked May 26th, 2015

    Not a bad idea!

  11. Avatar for Dan, thebigsmileXD
    Dan, thebigsmileXD February 2nd, 2016

    My browser says theres no program linked to the git-client protocol

  12. Avatar for haacked
    haacked February 2nd, 2016

    After you installed Visual Studio 2015?

  13. Avatar for Tuan_Luu
    Tuan_Luu February 18th, 2016

    Hi Phil,

    How can i custome Github extension in Visual Studio when i commit code? Because i want get a little information as: commit username, commit message...Please help me! Thanks.

  14. Avatar for haacked
    haacked February 18th, 2016

    That information is part of the Git extension in Visual Studio. Check out the Team Explorer > Settings section.

  15. Avatar for Tuan_Luu
    Tuan_Luu February 20th, 2016

    Hi Phil,

    Martin Woodward had presented for me a library LibGit2Sharp, It’s just what I need, thank for your help!

  16. Avatar for Yuan Mengyi
    Yuan Mengyi April 13th, 2016

    Thank you for the instructions, but I keep having issues logging into my Enterprise repository with my company account. The authentication is done via SAML, how i could get it to work from the extension? Thanks a lot!

  17. Avatar for haacked
    haacked April 14th, 2016

    Ah, we don't have SAML support yet for the extension. You'll have to go to your Enterprise instance and create a Personal Token (https://YOUR-GHE-ADDRESS/settings/tokens). Then use that token as your password.

  18. Avatar for Yuan Mengyi
    Yuan Mengyi April 14th, 2016

    Hi,
    Thank you for pointing me the direction. I have successfully logged on with the token. :)

  19. Avatar for hsv@2016
    hsv@2016 October 4th, 2016

    its still not working for me, is there any way to validate if added keys are working. WHen I log in from VS 2015, it says 'Login Failed' without giving any additional information.

  20. Avatar for Hidalgo
    Hidalgo October 4th, 2016

    i cannot upload my code to mu github.

  21. Avatar for Juliano Gonçalves
    Juliano Gonçalves December 23rd, 2016

    I was very disapointed when I noticed that the Pull Requests pane only had links to the pull requests in Github. Are there any plans to support a full code review experience from inside Visual Studio?

  22. Avatar for haacked
    haacked January 2nd, 2017

    That's a question you'll have to ask Microsoft. The GitHub extension is focused on adding support for GitHub.

  23. Avatar for Juliano Gonçalves
    Juliano Gonçalves January 2nd, 2017

    I'm not sure what you mean. Why would Microsoft themselves have to support code review against Github pull requests? Besides, after looking at this article i searched a bit and found out that Github pull requests reviews are planned already as evidence by this post https://github.com/github/V.... There are at least 3 separate issues on the official Github to track it. Am I missing something here?

  24. Avatar for haacked
    haacked January 2nd, 2017

    Ah, I misunderstood your question. Yes, there's plans for the full range of PR support. There's an open issue here: https://github.com/github/V...