Manage Git Repositories

Ticker

6/recent/ticker-posts

Manage Git Repositories

Question:  A new developer just joined the Nautilus development team and has been assigned a new project for which he needs to create a new repository under his account on Gitea server. Additionally, there is some existing data that need to be added to the repo. Below you can find more details about the task:

Click on the Gitea UI button on the top bar. You should be able to access the Gitea UI. Login to Gitea server using username max and password Max_pass123.

a. Create a new git repository story_blog under max user.

b. SSH into storage server using user max and password Max_pass123 and clone this newly created repository under user max home directory i.e /home/max.

c. Copy all files from location /usr/itadmin to the repository and commit/push your changes to the master branch. The commit message must be "add stories" (must be done in single commit).

d. Create a new branch max_cluster from master.

e. Copy a file story-index-max.txt from location /tmp/stories/ to the repository. This file has a typo, which you can fix by changing the word Mooose to Mouse. Commit and push the changes to the newly created branch. Commit message must be "typo fixed for Mooose" (must be done in single commit).

Note: For these kind of scenarios requiring changes to be done in a web UI, please take screenshots so that you can share it with us for review in case your task is marked incomplete. You may also consider using a screen recording software such as loom.com to record and share your work.


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

Solution:   

1. This task require  Gitea UI Login (refer Video below for more clarity)

     Create a new git repository story_blog under max user.

2. Login on storage server with user max 

thor@jump_host ~$ ssh max@ststor01

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

ECDSA key fingerprint is SHA256:0z85j/k+4Nf8WKbHJzxo1AOv4FeRA8LPET2N3BEkYyo.

ECDSA key fingerprint is MD5:74:e6:4d:c4:b3:80:07:be:03:30:0a:bf:1e:eb:e6:82.

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.

max@ststor01's password:

Welcome to xFusionCorp Storage server.

max $

3. Clone git repo which was created in Gitea UI 

max $ pwd

/home/max

max $ git clone http://git.stratos.xfusioncorp.com/max/story_blog.git

Cloning into 'story_blog'...

warning: You appear to have cloned an empty repository.

Checking connectivity... done.

max $

max $ cd story_blog/

max $ ls

max $


4. Copy all files from the location /usr/itadmin to the repository

max $ cp /usr/itadmin/*.*  .

max $ ls

frogs-and-ox.txt    lion-and-mouse.txt

max $


5. Git add & Commit with message given in task 

max $ git add .

max $ git commit -m  "add stories"

[master (root-commit) b650a14] add stories

 Committer: Linux User <max@ststor01.stratos.xfusioncorp.com>

Your name and email address were configured automatically based

on your username and hostname. Please check that they are accurate.

You can suppress this message by setting them explicitly. Run the

following command and follow the instructions in your editor to edit

your configuration file:

 

    git config --global --edit

 

After doing this, you may fix the identity used for this commit with:

 

    git commit --amend --reset-author

 

 2 files changed, 42 insertions(+)

 create mode 100644 frogs-and-ox.txt

 create mode 100644 lion-and-mouse.txt

max (master)$


6. Create a new branch from master as per the task 

max (master)$ git status

On branch master

Your branch is based on 'origin/master', but the upstream is gone.

  (use "git branch --unset-upstream" to fixup)

nothing to commit, working directory clean

max (master)$

max (master)$ git checkout -b max_cluster

Switched to a new branch 'max_cluster'

max (max_cluster)$


7. Copy story-index file from tmp to clone repo directory 

max (max_cluster)$ cp /tmp/stories/story-index-max.txt  .

max (max_cluster)$ ls

frogs-and-ox.txt     lion-and-mouse.txt   story-index-max.txt

max (max_cluster)$


8. Correct the file & git add , Commit with message given in task 

max (max_cluster)$ vi story-index-max.txt

max (max_cluster)$ cat story-index-max.txt

1. The Lion and the Mouse

2. The Frogs and the Ox

3. The Fox and the Grapes

4. The Donkey and the Dogmax (max_cluster)$

max (max_cluster)$

max (max_cluster)$ git add .

max (max_cluster)$ git commit -m "typo fixed for Mooose"

[max_cluster 6b30b28] typo fixed for Mooose

 Committer: Linux User <max@ststor01.stratos.xfusioncorp.com>

Your name and email address were configured automatically based

on your username and hostname. Please check that they are accurate.

You can suppress this message by setting them explicitly. Run the

following command and follow the instructions in your editor to edit

your configuration file:

 

    git config --global --edit

 

After doing this, you may fix the identity used for this commit with:

 

    git commit --amend --reset-author

 

 1 file changed, 4 insertions(+)

 create mode 100644 story-index-max.txt

max (max_cluster)$ git push -u origin master

Username for 'http://git.stratos.xfusioncorp.com': max

Password for 'http://max@git.stratos.xfusioncorp.com':

Counting objects: 4, done.

Delta compression using up to 48 threads.

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

Writing objects: 100% (4/4), 1.19 KiB | 0 bytes/s, done.

Total 4 (delta 0), reused 0 (delta 0)

remote: . Processing 1 references

remote: Processed 1 references in total

To http://git.stratos.xfusioncorp.com/max/story_blog.git

 * [new branch]      master -> master

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

max (max_cluster)$

max (max_cluster)$ git push -u origin max_cluster

Username for 'http://git.stratos.xfusioncorp.com': max

Password for 'http://max@git.stratos.xfusioncorp.com':

Counting objects: 3, done.

Delta compression using up to 48 threads.

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

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

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

remote:

remote: Create a new pull request for 'max_cluster':

remote:   http://git.stratos.xfusioncorp.com/max/story_blog/compare/master...max_cluster

remote:

remote: . Processing 1 references

remote: Processed 1 references in total

To http://git.stratos.xfusioncorp.com/max/story_blog.git

 * [new branch]      max_cluster -> max_cluster

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

max (max_cluster)$



9.  Click on Finish & Confirm to complete the task successful

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