Tasks: Git Manage Remotes
Date: 16 June 2023
The xFusionCorp development team added updates to the project that is maintained under /opt/news.git repo and cloned under /usr/src/kodekloudrepos/news. Recently some changes were made on Git server that is hosted on Storage server in Stratos DC. The DevOps team added some new Git remotes, so we need to update remote on /usr/src/kodekloudrepos/news repository as per details mentioned below:
- In /usr/src/kodekloudrepos/news repo add a new remote dev_news and point it to /opt/xfusioncorp_news.git repository.
- There is a file /tmp/index.html on same server; copy this file to the repo and add/commit to master branch.
- Finally push master branch to this new remote origin.
Solution:
ststor01 172.16.238.15 ststor01.stratos.xfusioncorp.com natasha Bl@kW Nautilus Storage Server
Login to Storage
[root@ststor01]# cd /usr/src/kodekloudrepos/news
[root@ststor01 news]# git status
[root@ststor01 news]# git branch -a
[root@ststor01 news]# git remote add dev_news /opt/xfusioncorp_news.git
[root@ststor01 news]# ls
info.txt
[root@ststor01 news]# cp /tmp/index.html .
[root@ststor01 news]# ll
total 8
-rw-r--r-- 1 root root 120 Jun 14 10:03 index.html
-rw-r--r-- 1 root root 34 Jun 14 09:49 info.txt
[root@ststor01 news]# git init
[root@ststor01 news]# git status
[root@ststor01 news]# git add index.html
[root@ststor01 news]# git status
[root@ststor01 news]# git commit -m "Add index.html"
[root@ststor01 news]# git status
[root@ststor01 news]# git push -u dev_news master
[root@ststor01 news]# git status
Task Details : Set Up Git Repository on Storage Server
Date: 18 June 2023
The Nautilus development team shared with the DevOps team requirements for new application development, setting up a Git repository for that project. Create a Git repository on Storage server in Stratos DC as per details given below:
- Install git package using yum on Storage server.
- After that create/init a git repository /opt/official.git (use the exact name as asked and make sure not to create a bare repository).
Solution:
ststor01 172.16.238.15 ststor01.stratos.xfusioncorp.com natasha Bl@kW Nautilus Storage Server
Login to Storage
[root@ststor01 ~]# git init --bare /opt/official.git
Initialized empty Git repository in /opt/official.git/
[root@ststor01 ~]# ls -l /opt/official.git/
Tasks: Git Setup from Scratch
Date: 22 June 2023
Some new developers have joined xFusionCorp Industries and have been assigned Nautilus project. They are going to start development on a new application, and some pre-requisites have been shared with the DevOps team to proceed with. Please note that all tasks need to be performed on storage server in Stratos DC.
- Install git, set up any values for user.email and user.name globally and create a bare repository /opt/cluster.git.
- There is an update hook (to block direct pushes to master branch) under /tmp on storage server itself; use the same to block direct pushes to master branch in /opt/cluster.git repo.
- Clone /opt/cluster.git repo in /usr/src/kodekloudrepos/cluster directory.
- Create a new branch xfusioncorp_cluster in repo that you cloned in /usr/src/kodekloudrepos.
- There is a readme.md file in /tmp on storage server itself; copy that to repo, add/commit in the new branch you created, and finally push your branch to origin.
- Also create master branch from your branch and remember you should not be able to push to master as per hook you have set up.
Solution:
ststor01 172.16.238.15 ststor01.stratos.xfusioncorp.com natasha Bl@kW Nautilus Storage Server
Login to Storage
# ssh natasha@ststor01
Install git package
# yum install -y git
Setup git config for the user.email and user.name globally
# git config --global --add user.email natasha@stratos.xfusioncorp.com
Create a bare repository
# git init --bare /opt/cluster.git
Copy the /tmp/update hook to hooks directory under /opt/cluster.git repo
# cp /tmp/update /opt/cluster.git/hooks/
clone git repository under /usr/src/kodekloudrepos/cluster directory.
# git clone /opt/cluster.git
Change to the cloned directory /usr/src/kodekloudrepos/cluster and create a new branch
# git checkout -b xfusioncorp_cluster
Copy the readme.md file in /tmp to repo, add/commit in the new branch and finally push your branch to origin
# git add readme.md
# git commit -m "Added Readme file"
# git push origin xfusioncorp_cluster
To validate the task switch to master branch and attempt a push to origin git checkout -b master git push origin master It will throw an error of hook declined. Accept this review to continue with your task
Tasks: Git Clone Repositories
Date: 15 July 2023
DevOps team created a new Git repository last week; however, as of now no team is using it. The Nautilus application development team recently asked for a copy of that repo on Storage server in Stratos DC. Please clone the repo as per details shared below:
- The repo that needs to be cloned is /opt/news.git
- Clone this git repository under /usr/src/kodekloudrepos directory. Please do not try to make any changes in repo.
Solution:
ststor01 172.16.238.15 ststor01.stratos.xfusioncorp.com natasha Bl@kW Nautilus Storage Server
Login to Storage
# ssh natasha@ststor01
[root@ststor01 kodekloudrepos]# git clone /opt/news.git
Cloning into 'news'...
warning: You appear to have cloned an empty repository.
done.
[root@ststor01 kodekloudrepos]#
Date: 17 Jan 2024
The Nautilus development team shared requirements with the DevOps team regarding new application development.—specifically, they want to set up a Git repository for that project. Create a Git repository on Storage server in Stratos DC as per details given below:
- Install git package using yum on Storage server.
- After that create a bare repository /opt/games.git (make sure to use exact name).
Solution:
ststor01 172.16.238.15 ststor01.stratos.xfusioncorp.com natasha Bl@kW Nautilus Storage Server
Login to Storage
# yum install git
# sudo mkdir -p /opt/games.git
# cd /opt/games.git
# git init --bare
[root@ststor01 games.git]# ls -la
total 40
drwxr-xr-x 7 root root 4096 Jan 17 15:22 .
drwxr-xr-x 1 root root 4096 Jan 17 15:22 ..
-rw-r--r-- 1 root root 23 Jan 17 15:22 HEAD
drwxr-xr-x 2 root root 4096 Jan 17 15:22 branches
-rw-r--r-- 1 root root 66 Jan 17 15:22 config
-rw-r--r-- 1 root root 73 Jan 17 15:22 description
drwxr-xr-x 2 root root 4096 Jan 17 15:22 hooks
drwxr-xr-x 2 root root 4096 Jan 17 15:22 info
drwxr-xr-x 4 root root 4096 Jan 17 15:22 objects
drwxr-xr-x 4 root root 4096 Jan 17 15:22 refs
[root@ststor01 games.git]#
Date: 31 May 2024
The Nautilus development team has initiated a new project development, establishing various Git repositories to manage each project's source code. Recently, a repository named /opt/cluster.git was created. The team has provided a sample index.html file located on the jump host under the /tmp directory. This repository has been cloned to /usr/src/kodekloudrepos on the storage server in the Stratos DC.
- Copy the sample index.html file from the jump host to the storage server placing it within the cloned repository at /usr/src/kodekloudrepos/cluster.
- Add and commit the file to the repository.
- Push the changes to the master branch.
Solution:
ststor01 172.16.238.15 ststor01.stratos.xfusioncorp.com natasha Bl@kW Nautilus Storage Server
Login to Storage
[root@ststor01 cluster]# scp /tmp/index.html natasha@ststor01:/tmp
[root@ststor01 cluster]# cp /tmp/index.html /usr/src/kodekloudrepos/cluster
[root@ststor01 cluster]# git add index.html
[root@ststor01 cluster]# git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: index.html
[root@ststor01 cluster]# git commit -m 'index.html'
[master eedfbf1] index.html
1 file changed, 1 insertion(+)
create mode 100644 index.html
[root@ststor01 cluster]# git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
[root@ststor01 cluster]# git branch
* master
[root@ststor01 cluster]# git push origin master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 36 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 328 bytes | 328.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To /opt/cluster.git
0b9eebb..eedfbf1 master -> master
[root@ststor01 cluster]#
Date: 3 June 2024
The Nautilus developers are engaged in active development on one of the project repositories located at /usr/src/kodekloudrepos/news. During testing, several test branches were created, and now they require cleanup. Here are the requirements provided to the DevOps team:
- On the Storage server in Stratos DC, delete a branch named xfusioncorp_news from the /usr/src/kodekloudrepos/news Git repository.
Solution:
ststor01 172.16.238.15 ststor01.stratos.xfusioncorp.com natasha Bl@kW Nautilus Storage Server
Login to Storage
[root@ststor01 news]# git branch
master
* xfusioncorp_news
[root@ststor01 news]# git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
[root@ststor01 news]# git branch -D xfusioncorp_news
Deleted branch xfusioncorp_news (was bb377db).
[root@ststor01 news]# git branch
* master
[root@ststor01 news]#
Date: 15 Jan 2025
The Nautilus development team shared with the DevOps team requirements for new application development, setting up a Git repository for that project. Create a Git repository on Storage server in Stratos DC as per details given below:
- Install git package using yum on Storage server.
- After that, create/init a git repository named /opt/media.git (use the exact name as asked and make sure not to create a bare repository).
Solution:
ststor01 172.16.238.15 ststor01.stratos.xfusioncorp.com natasha Bl@kW Nautilus Storage Server
Login to Storage
[root@ststor01 ~]# yum install git
[root@ststor01 opt]# mkdir -p /opt/media.git
[root@ststor01 opt]# cd media.git/
[root@ststor01 media.git]# git init
No comments:
Post a Comment