Question : The xFusionCorp development team added updates to the project that is maintained under /opt/apps.git repo and cloned under /usr/src/kodekloudrepos/apps. 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/apps repository as per details mentioned below:
a. In /usr/src/kodekloudrepos/apps repo add a new remote dev_apps and point it to /opt/xfusioncorp_apps.git repository.
b. There is a file /tmp/index.html on same server; copy this file to the repo and add/commit to master branch.
c. Finally push master branch to this new remote origin.
Solution:
1. At first login on storage server & Switch to root user
thor@jump_host
~$ ssh natasha@ststor01 The authenticity
of host 'ststor01 (172.16.238.15)' can't be established. ECDSA key
fingerprint is SHA256:f2NFHNBtdYn2B0j54dhSIiO4QXPBZctekutOmuXdyWc. ECDSA key
fingerprint is MD5:e3:54:0f:c3:51:7b:33:d2:38:06:b2:80:25:99:a1:52. Are you sure you
want to continue connecting (yes/no)? yes Warning:
Permanently added 'ststor01,172.16.238.15' (ECDSA) to the list of known
hosts. natasha@ststor01's
password: [natasha@ststor01
~]$ sudo su - We trust you have received the usual lecture from the local System Administrator.
It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great
responsibility. [sudo] password for natasha: [root@ststor01
~]# |
2. Navigate to the cloned directory
[root@ststor01
~]# cd /usr/src/kodekloudrepos/apps [root@ststor01
apps]# ll total 4 -rw-r--r-- 1
root root 34 Jul 17 08:01 info.txt [root@ststor01
apps]# |
[root@ststor01
apps]# git remote add dev_apps /opt/xfusioncorp_apps.git [root@ststor01
apps]# |
[root@ststor01
apps]# cp /tmp/index.html . [root@ststor01
apps]# ll total 8 -rw-r--r-- 1
root root 120 Jul 17 08:13 index.html -rw-r--r-- 1
root root 34 Jul 17 08:01 info.txt [root@ststor01
apps]# |
6. Git initialize the new remote repo
[root@ststor01
apps]# git init Reinitialized
existing Git repository in /usr/src/kodekloudrepos/apps/.git/ [root@ststor01
apps]# |
[root@ststor01
apps]# git add index.html [root@ststor01
apps]# git commit -m "add index.html" [master 0fa0e06]
add index.html 1 file changed, 10 insertions(+) create mode 100644 index.html [root@ststor01
apps]# |
[root@ststor01
apps]# git push -u dev_apps master Counting
objects: 6, done. Delta
compression using up to 48 threads. Compressing
objects: 100% (4/4), done. Writing objects:
100% (6/6), 582 bytes | 0 bytes/s, done. Total 6 (delta
0), reused 0 (delta 0) To
/opt/xfusioncorp_apps.git * [new branch] master -> master Branch master
set up to track remote branch master from dev_apps. [root@ststor01
apps]# |
Happy Learning!!!!
0 Comments