0 Ratings Rate it

This AWS DevOps tutorial will show you how to play with GIT and GIT commands.

Today we will discuss with git installation and start with some git commands
(1) git add
(2) git commit
(3) git push

We will take some simple content in one region and push it to the central repo
and will pull it from another region like that.

Let’s do this.

1.Launch 2 ec2 instances (Linux) 1.Mumbai region 2.London region
2.Install git in both the regions. Before this we have to run some commands like this
3.Git installed on Mumbai region
4.Now do the same in London region.
5.Now both regions installed git.
6.Now Create a directory and go inside it.
7.”mkdir mumbaigit” Run this.
8.Now run “git init” it will create the workspace, staging, local repo.
9.Now create one file and add some content inside it.
10.”touch myfile” run this and add some content inside the myfile.
11.Now check the status “git status”.
12.It is showing that nothing committed and nothing tracked..
13.Let’s add and commit this.
14.”git add .” it will add this myfile to the staging section and then it’s trackable.
15.git commit -m “1st commit from Mumbai” run this command for commit.
Here the comment is your wish.
16.Now check the log with “git log”.
With this we can track when the changes happen and who did that.
author name and email will display.
17.Now will change that author name and email.
18.git config –global user.name “your name”
git config –global user.email “your email”
Run these commands with name and email.
19.Now check the author name and email list.
git config –list.
20.Now Let’s add some content again in myfile. Now commit this also. We have to add that first. Done.
21.Now let’s create the Git hub repo (Central repo).
22.git remote add origin https://github.com/ursgithub/devops.git​ run like this
git push -u origin master
23.see the file pushed to the central repo.
24.Now go to that London region and pull it.
25.make dir here also “mkdir londongit”
26.Git init here also.
27.Now pull the content from central repo (from GitHub)
28.”git pull origin master” run this.
29.git show commit id to check the particular commit id changes.
30.Now here from London we are adding some content in that myfile and push.
31.now add and commit.
if you want track who made changes like that
configure those name and email.
32.now add some content again and will add and commit.
33.Now push the changes made in London to central repo.
34.Now pull again from Mumbai. Done.


0 Ratings Rate it

Written by admin