Deploying from local git repository to Azure websites (w video)
One of the options Azure Websites offer is deployment via source control. We will deploy from a local Git repository to the staging site. You can follow the exact steps and deploy to the production site to practice if you don’t want to pay for the staging option. In the Quick Create menu or Dashboard select integrated source control.
clip_image002
Select Git and give it some time.
clip_image004
Afterwards we will get the git url and instructions.
clip_image006
clip_image008
Our website code will be deployed to the staging site when we push the code to that url. This means that you most likely will want to have several branches. For those of you familiar with git, it’s worth creating a branch for deployment to azure and then pushing changes to it from your main dev branch. For those of you who are new to git however, we’ll keep our demo far more straightforward. We’ll keep it simple here however.
Using the git shell the[DanM1] first thing I’ll do is navigate to the folder, and give it a git init which initializes git in that folder. Commands:
clip_image010
git init
Then I’ll set the remote branch which sets a remote connection, and we’ll set it to our azure git repository which Azure created for us, by using the URL provided after we added integrated source control with Git.
git remote add azure -URL
We now have a convenient way of working with our remote connection, by using the ‘azure’ variable now set to hold a reference to the url. You can of course call it what you want.
Next up is to add all our files so we can commit. Commit means we are committing the files locally.
git add .
git commit -m “First commit!
-m adds a message, and we have to do that, and it’s a good practice to write something that makes sense.
Now we are ready to push to azure. Notice ‘master’, this is the branch we are pushing to.
git push azure master
And we have now successfully pushed our changes and published to our staging site on Azure Websites. Wasn’t that easy?
Comments
Last modified on 2014-02-10