Task:
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:
a. In /usr/src/kodekloudrepos/news repo add a new remote dev_news and point it to /opt/xfusioncorp_news.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.
Step 1) Login to the Storage Server as a root user
thor@jump_host /opt$ ssh natasha@ststor01
The authenticity of host 'ststor01 (172.16.238.15)' can't be established.
ECDSA key fingerprint is SHA256:vJAsZuUSoXH3n5luk4cHC4hGeA8s8cFXoy5mo2CkOCY.
ECDSA key fingerprint is MD5:33:5e:d1:86:a5:91:28:d8:fd:f6:7d:6b:83:7a:82:83.
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:
Step 2) Validate Repository location
[root@ststor01 ~]# cd /usr/src/kodekloudrepos/news
[root@ststor01 news]# ls -rlt
total 4
-rw-r--r-- 1 root root 34 May 30 03:23 info.txt
[root@ststor01 news]# cd /opt/
[root@ststor01 opt]# ls -rlt
total 8
drwxr-xr-x 7 root root 4096 May 30 03:23 news.git
drwxr-xr-x 7 root root 4096 May 30 03:23 xfusioncorp_news.git
Step 3) In /usr/src/kodekloudrepos/news repo add a new remote dev_news and point it to /opt/xfusioncorp_news.git repository.
[root@ststor01 news]# git remote add dev_news /opt/xfusioncorp_news.git
Step 4) There is a file /tmp/index.html on same server; copy this file to the repo and add/commit to master branch.
[root@ststor01 news]# cp /tmp/index.html .
[root@ststor01 news]# git add index.html
[root@ststor01 news]# git commit -m "add index.html"
[master ca81dc7] add index.html
1 file changed, 10 insertions(+)
create mode 100644 index.html
Step 5) Finally push master branch to this new remote origin.
[root@ststor01 news]# git push -u dev_news master
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (6/6), 583 bytes | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To /opt/xfusioncorp_news.git
* [new branch] master -> master
Branch master set up to track remote branch master from dev_news.
1 comment:
a very useful blog to the learner so happy to be part of this blog. Thank you.
DevOps Online Training
Post a Comment