Published articles on other web sites*

Published articles on other web sites*

How to add a ASP.NET MVC solution to a Git repository

In this tutorial we’ll be looking at how to add a ASP.NET MVC solution to a Git repository.

This tutorial is part of a series about how to deploy ASP.NET MVC applications to AppHarbor.

If you haven’t installed Git yet use this guide to get you started.

Before you initialize you git repository it’s a good idea to have a .gitignore file in root of the repository which instructs Git what files to ignore.

As you can see in the example below it excludes things which you don’t need to
version control such as output directories and anything created by ReSharper.

#ignore thumbnails created by windows
#Ignore files build by Visual Studio

In the directory containing your ASP.NET MVC solution, right click and start Git Bash, or start Git Bash and navigate to the directory.

Git Directory Location

If this is the first time you’re using Git I recommended executing the following commands to set your user name and email address in the git.config which are used to track commits in the Git repository.

git config --global jagreehal
git config --global

To initialise a repository execute the following command

git init

Because we’ve used a gitignore file we can use the following Git command to add all files in the directory (and sub directories) into the repository.

git add .

Alternatively you could have added each file individually like this (for those who want total control)

git add <filename>

The final step is to commit your changes. The –m option allows you to add a message (otherwise you’ll be promoted for one)

git commit -m "Initial commit"

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...