Follow the steps below to create and publish a Git repository on Microsoft Windows. Git is a popular set of tools for source code management. It is used to record and track changes made to computer programs by a group of programmers, and to help reconcile all these changes.
1. If you have not already done so, download and install XAMPP, by the “Apache Friends” group. XAMPP is a bundle of software packages commonly used to run web applications. As of this writing, the latest version is available for download at the URL “https://www.apachefriends.org/download.html“.
2. If you have not already done so, download and install Xamarin Studio, which incorporates MonoDevelop. MonoDevelop is an IDE for the Mono programming platform, which in turn is an open source reimplementation of Microsoft’s .NET platform. As of this writing, the latest version is available for download at the URL “http://www.monodevelop.com/download/“.
3. If you have not already done so, download and install Git. . As of this writing, the latest version is available for download at the URL “https://git-scm.com/downloads“.
4. Create a new directory named “src” at any convenient location. For this example, it is recommended to put the “src” directory at the root of the C: drive, that is, at “C:\src\”.
5. Start Xamarin Studio. Select the “New – Solution…” item from the main menu. On the New Project dialog that appears, click the “.NET” item in the left pane, then click the “Console Project” item in the right pane, then click the Next button. On the next page, enter the value “TestProject” in the Name box, enter the location of the “src” directory (perhaps “C:\src\”) in the Location box, then click the Create button. A default solution will be created that displays the message “Hello World!” when run. Make no modifications to the source code yet. Close the solution by selecting the item “File – Close Solution” from the main menu.
6. Open a command prompt and run the commands below to create a new Git repository, and add the files of the “TestProject” solution to it.
cd /src/TestProject git init git add . git commit -m "Initial commit."
7. Download and install SCM Manager, by Sebastian Sdorra. SCM Manager provides a set of tools for more easily administering and publishing Git repositories. As of this writing, the latest version is available for download at the URL “https://www.scm-manager.org/download/“. Download the .zip archive file and extract it to any conveninent location.
8. Locate the “conf” directory within the extracted SCM Manager directory and the file “server-config.xml” within it. Open the file in a text editor (preferably one that can handle Unix-style line endings like Notepad++). Within the file, locate the line that reads “<SystemProperty name=”jetty.port” default=”8080″ />”, change the text “8080” to “8081” within it, and save. Changing the port number from the default value in this way is a good idea, because it prevents the conflicts that inevitably occur when multiple applications attempt to use the same default port number.
9. Locate the “bin” directory within the extracted SCM Manager directory and execute the batch file “scm-server.bat” within it. Wait for the SCM Manager service to start, and leave the console window running afterward.
10. Open a web browser and navigate to the URL “http://localhost:8081/scm“. Enter the value “scmadmin” in both the Username and Password boxes, then click the Login button.
11. On the SCM Manager main page, click the Repository Types link in the left pane. On the Repository Config page that appears, locate the “Repository directory” box in the “Git Settings” section, and make a note of the value it contains.
12. Open a new command prompt, navigate to the repository directory for SCM Manager discovered in the previous step, and run the command below to copy the “TestProject” Git repository to that directory.
mkdir TestProject cd TestProject git clone --bare \src\TestProject .
13. Back in SCM Manager, click the Import Repositories link in the left pane. On the Repository Import Wizard dialog that appears, select the “Git” radio button, then click the Next link. On the next page of the wizard, click the “Import from directory” radio button and click the Next button again. Verify that a message is displayed saying that the “TestProject” repository has been imported.
14. Back on main SCM Manager page, locate the newly imported “TestProject” repository in the Repositories tab and click to select it. The details of the selected repository will appear in the bottom pane. Make a note of the value in the Url field, which should be “http://localhost:8081/scm/git/TestProject“.
15. Back on the command prompt, navigate to any convenient directory (perhaps “C:\Temp\”) and run the command “git clone http://localhost:8081/scm/git/TestProject” to clone the repository and thus verify that it was successfully published.