Git Repository Update

Ticker

6/recent/ticker-posts

Git Repository Update

Question :  The Nautilus development team started with new project development. They have created different Git repositories to manage respective project's source code. One of the repo /opt/cluster.git was created recently. The team has given us a sample index.html file that is currently present on jump host under /tmp. The repository has been cloned at /usr/src/kodekloudrepos on storage server in Stratos DC.

Copy sample index.html file from jump host to storage server under cloned repository at /usr/src/kodekloudrepos, add/commit the file and push to master branch.

Please Note :-  Perform the below commands based on your question server,  user name & other details that might differ. So please read the task carefully before executing it. 
All the Best 👍

Solution:   

1.  At 1st SCP index.html file from jump server to the storage server    

thor@jump_host ~$  sudo scp /tmp/index.html  natasha@ststor01:/tmp

 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 thor:

The authenticity of host 'ststor01 (172.16.238.15)' can't be established.

ECDSA key fingerprint is SHA256:PTU+nmOOzerqVhiNKEgLVNNdfNtr6yd9bPJz2T2w3CY.

ECDSA key fingerprint is MD5:0a:a4:ab:0c:c1:60:cf:23:13:ec:0e:81:34:ee:33:16.

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:

index.html                                                                                   100%   27    65.6KB/s   00:00   

thor@jump_host ~$


2Login on storage server  & Switch 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:PTU+nmOOzerqVhiNKEgLVNNdfNtr6yd9bPJz2T2w3CY.

ECDSA key fingerprint is MD5:0a:a4:ab:0c:c1:60:cf:23:13:ec:0e:81:34:ee:33:16.

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 ~]#

 3Go to project repositories as per the task     

[root@ststor01 ~]# cd   /usr/src/kodekloudrepos/cluster/

[root@ststor01 cluster]# ll

total 8

-rw-r--r-- 1 root root 34 Aug  7 05:09 info.txt

-rw-r--r-- 1 root root 26 Aug  7 05:09 welcome.txt

[root@ststor01 cluster]#


4Copy html file from tmp to repo 
       

[root@ststor01 cluster]#  cp /tmp/index.html  .

[root@ststor01 cluster]# ll

total 12

-rw-r--r-- 1 root root 27 Aug  7 05:16 index.html

-rw-r--r-- 1 root root 34 Aug  7 05:09 info.txt

-rw-r--r-- 1 root root 26 Aug  7 05:09 welcome.txt

[root@ststor01 cluster]#

5.  Add and commit the index.html file  (refer to Video below for more clarity)   

[root@ststor01 cluster]# git add index.html

[root@ststor01 cluster]#  git commit -m "add index.html"

[master f270940] add index.html

 1 file changed, 1 insertion(+)

 create mode 100644 index.html

[root@ststor01 cluster]#


6. Finally push master branch to the origin.

[root@ststor01 cluster]# git push -u origin master

Counting objects: 4, done.

Delta compression using up to 48 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 330 bytes | 0 bytes/s, done.

Total 3 (delta 0), reused 0 (delta 0)

To /opt/cluster.git

   34ed832..f270940  master -> master

Branch master set up to track remote branch master from origin.

[root@ststor01 cluster]#

    

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , 
please go through and share your comments. Like and share the knowledge






Post a Comment

0 Comments

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user