Devops - Git - Senario Based Taks.
1. Login to AWS Console ---
Create the new instance – Confirm 2/2 check passed
2. Login
server through putty :
Switch to root user - sudo –i
Update the server – apt update
3. Install Git and check the version :
apt install git
git --version
4. Create
the folder and file :
Folder : mkdir git
5. Add
3 files working directories to staging area :
Command : git init
Check the status : git status
6. Move
only Code.txt and Output.txt files to Staging area
· git add Code.txt Output.txt – Check the status - git status
7. Commit our files from staging to local repo:
git commit –m “This is my
new file”
Now both files are in local repo
8. Create New id in Git Hub and configure credential
globally:
In server configure git username and password and confirm onces
git config --global user.name "K……..A"
git config --global user.email "……..@gmail.com"
git
config –list
9. Now to access the remote repository, we need credentials – Username and Password as Token, Generated from github
Login Git hub – Settings – In Developer settings - Personal access tokens- Generate the new token.
10.Create the new repository in Git hub and clone with our local respository.
git push origin master
git remote add origin “Url of github”
git branch -M main
git push -u origin main
11. Now 2 files are moves to git hub:
2.. Scenario Based tasks :
1.. Create a Git working directory with feature1.txt and feature2.txt in the master branch
2. Create 3 branches develop, feature1 and feature2
3. In develop branch create develop.txt, do not stage or commit it
4. Stash this file and check out to feature1 branch
5. Create new.txt file in feature1 branch, stage and commit this file
6. Checkout to develop, unstash this file and commit.
* Update the server – apt update
2. Installed git in the server:
apt install git
8. Now in developer branch is clean.
Comments
Post a Comment