Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Scripts          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

How to move a project from CodePlex to GitHub


By:   |   Last Updated: 2017-06-07   |   Comments   |   Related Tips: More > Scripts

Problem

Open source projects need an open platform to live, preferably one with source code management, download management, and a discussion forum for each project.  Microsoft created CodePlex as such a site back in 2006.  In April of 2017 they announced that it would be closing in favor of hosting on GitHub.   Iíve hosted a project named SQL Job Scripter on CodePlex since 2012.  How am I going to move it from CodePlex to GitHub?

Solution

For several projects I created a large number of SQL Server Agent Jobs, around 50, to get some very large tasks completed in parallel.   SQL Job Scripter was written so that those jobs could easily be turned into text files and either moved to another server or be checked into source control.  Since it worked so nicely Iíve used it on all my jobs and saved them away in TFS, just in case they were needed and to track the occasional change. 

When I saw the notice that CodePlex would be closing I was a little saddened.  Iíve pulled several projects from CodePlex over the years and found it very helpful.  Time marches on and the need for a Microsoft only open source web site just isnít there anymore. You may remember 2001 when Steve Ballmer railed against open source and called Linux a Cancer.  In recent years, Microsoft has done a lot of changing and they maintain key portions of their development tools and development environment as open source projects on GitHub.  Iím talking about tools like the Roslyn compiler for C# and Visual Basic as well as the .Net Core.  They even use it for some of their private development projects.

What are Git and GitHub?

Git is the distributed source control system that was originally created for Linux development.  Like a lot of Linux, Git is a command line tool.  However, there is now a git-gui and there are third party tools to work with Git and most importantly Visual Studio 2015 and 2017 have built-in support even in the community editions.  Git supported on Linux, Max and Windows.  Itís free and distributed under the GNU General Public License version 2.0. You can download git from https://git-scm.com/downloads.

GitHub is a Git repository and web site to host Git based projects.  It adds a web interface and every project can have a wiki easier to use than the command line.  GitHub is free for open source projects but can also be used on a paid basis for private projects.  Many development tools, support Git and GitHub for source control.  One exception is SQL Server Management Studio (SSMS). GitHub offers more than source control.  Each project can have an issue tracker and a Wiki to go along with the source control.

Moving SQL Job Scripter

To get started with moving the SQL Job Scripter project to GitHub I started by going to https://github.com and created an account.  They require only a user name, e-mail address and password.  You can add a picture, description and a few other items like your employer and web site.  My profile is at https://github.com/anovick.

There is a migration tool on CodePlex that is supposed to allow you to move a project to GitHub.  I found that it didnít work. Attempts to complete the process with this tool failed in IE, Firefox and Chrome.  Others have reported similar failures.  I also went down the command line path with a tool called git-tf.  That also didnít succeed.

After some research I decided to try Visual Studio.  I started with the project on my hard drive and I opened it in Visual Studio 2017, which has built in Git Support and then opened Team Explorer:

Visual Studio 2017 Team Exporer - Description: This shows the GitHub area of Team Explorer

In the GitHub area I hit the Create button that you see above and was asked to login to GitHub and then fill in a screen to create the project like this:

Visual Studio Create a GitHub Repository - Description: Creating the repository from Visual Studio


That worked and Team Explorer showed my project:

Team Explorer Showing the project created - Description: Team Explorer Showing the project created


On the GitHub we site only the README.md and .gitignore files were present.  I still had to check in the VS solution, project and .CS files.

The next step is to add the solution to source control with the File > Add to Source Control menu.  That seemed to work.  And the Output windows even showed that there was a commit

VS Output Windows showing the commit

When I went to the web GitHub repository again the README.md and .gitignore files were present but none of my project files were there.  It turns out that the commit was only in the local repository on my computer.  To get the code to the GitHub repository it must be synced.  I found that on the Team Explorer here:

Team Explorer Sync window - Description: Sync to copy files up to GitHub


Pressing the blue ďSyncĒ link lead to the Synchronization window:

Team Explorer Syncronzation 2 - Description: MOre fields for syncing. Press the Publisht to GitHub buttion

I pressed ďPublish to GitHubĒ and some additional fields opened.  I filled them and pressed the Publish button.

Publish to GitHub - Description: More fields then press Publish


In a few seconds it showed the connection to the project:

Team Explorer shows link to the project - Description: Team Explorer shows link to the project


Clicking on the link lead to the GitHub site and my files were checked in! 

GitHub web site page for sql_job_scripter project - Description: The GitHub web site page for sql_job_scripter project


The README.md file was no longer there but I added one with the full description of the project.  Iíve also added the documentation to the Wiki of the project.  Hereís the documentation for you:

SQL Job Scripter is a command line utility that produces scripts of SQL Agent jobs. It will script either to a single file or to one file per job, suitable for source control.

switch parameter description
-S server_name server name to connect to
-d directory output directory use double quotes if there are spaces
-p prefixofjob prefix of the job name to select ex: "DBA_"
-1 one_file put the output into just one file
-m many_files put the output into many files

Hereís an example command line:

sqljobscripter -S (local) -p DBA_ -m -1 d "c:\source control\server1\jobs"

The defaults for server, directory and prefix are also in the sqljobscripter.exe.config file so they donít have to be on the command line.

I build the EXE from the Visual Studio project and move it to my server then run it from a SQL Agent Job every day storing the results on a network directory.  Then as I make changes Iíll check in the changes to TFS.  Not GitHub.  At least, not yet.

Finally, the project on CodePlex should be changed to let everyone know that itís been moved to GitHub.  Thatís done by going to the Settings tab of the project on CodePlex and thereís a field to enter New Project Location:

Next Steps

Give SQL Job Scripter a try.  You can pull the project by going to the site and hitting Open in Visual Studio or download the whole project as a zip file.  That doesnít even require a GitHub account.

GitHub open or download the project - Description: GitHub open or download the project


Last Updated: 2017-06-07


get scripts

next tip button



About the author
MSSQLTips author Andy Novick Andy Novick is a SQL Server Developer in the Boston area with 25 years of database and application development experience.

View all my tips




Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



Learn more about SQL Server tools