Using the sample created, set up a local deployment target and test deployment using Git.
- [Instructor] Now we'll set up and test a very simple deployment to another directory on your local system. This'll be our first push or deployment using git. If you're familiar with git remotes already you can move onto the next movie. We'll be setting up the specific remotes for each deployment target during the following chapters. I won't do a sweeping overview of everything git can do, discover the commands we'll be needing for the deployment processes. There's other classes in the library that focus on git. And if you're interested I encourage you to check those out.
So change into the exercise files directory on your system and type git init. That creates a git repository in the directory that you're in. But there aren't any files associated with it yet. So we're going to do a git add -A. That told git to add all of the files that it could find in the directory. So let's commit them. Git commit -a -m initial exercise files commit.
Excellent. Now we have a local repository to work with. This repository could be a clone of another workspace or it could be origin for yet a third workspace. We're going to set up a target repository now here on your local system. So change into the parent directory for the exercise files folder. Cd.. And now I'm going to do a clone of exercise files into a directory called local_clone. So git clone exercise files local_clone.
Great. The target is now set up so we can test the deployment for the main repository. First we need to change the checked out branch in the local clone because git does not like to do pushes to repositories with the target branch checked out already. So cd into local clone git checkout, we'll check out a temporary branch. And let's go to exercise files. So what we need to do now is we need to use the remote command.
What the remote does is it links different repositories together so that you can push commits from one to the other. So we're going to set up a remote target for our local clone. Git remote add, and the clone we're going to call it second. So this command says to git remote, and we're going to add a new remote, and the remote is going to be named second. And we can find it at local clone. Now if we were creating from a remote system, then the URL would go here instead of the file path.
So now we can do a git push second master. But everything is already set because we just created the repository, so we need to make a change to one of the files. And we'll use the README file. Another new line for testing. And so we do a git commit here in the exercise files directory. All changed files with a message pushing line to local clone.
Git push second master. And it sent the file over. So let's go ahead and go take a look in that directory. Remember that it's not got master checked out right now. So I'm going to change that. Git checkout master. Let's look at the README file. Another new line for testing. There it is. So as we move through the course we're going to discover how to set up tracking for git branches so that different branches deploy to different remote repository locations by default.
And then we'll move onto platforms where the application is built on deployment and is still triggered by git.
- MongoDB and GitHub setup
- Creating a Heroku app
- Deployment using Elastic Beanstalk
- Azure host creation and environment configuration
- Continuous deployment tools
- Working with Jenkins, Travis CI, and CircleCI