The Nautilus application development team has been working on a project repository /opt/official.git. This repo is cloned at /usr/src/kodekloudrepos on storage server in Stratos DC. They recently shared the following requirements with DevOps team: Create a new branch devops in /usr/src/kodekloudrepos/official repo from master and copy the /tmp/index.html file (present on storage server itself) into the repo. Further, add/commit this file in the new branch and merge back that branch into master branch. Finally, push the changes to the origin for both of the branches.
thor@jumphost ~$ ssh natasha@ststor01
The authenticity of host ‘ststor01 (172.16.238.15)’ can’t be established.
ED25519 key fingerprint is SHA256:URW/60RfKkMd7RnElxCjToDcgwxBmhWRO5WzFq8mnZo.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ‘ststor01’ (ED25519) to the list of known hosts.
natasha@ststor01’s password:
[natasha@ststor01 ~]$ cd /usr/src/kodekloudrepos/official
[natasha@ststor01 official]$ git checkout master
fatal: detected dubious ownership in repository at ‘/usr/src/kodekloudrepos/official’
To add an exception for this directory, call:
git config --global --add safe.directory /usr/src/kodekloudrepos/official
[natasha@ststor01 official]$ ^C
[natasha@ststor01 official]$ git config --global --add safe.directory /usr/src/kodekloudrepos/official
[natasha@ststor01 official]$ git checkout master
fatal: Unable to create ‘/usr/src/kodekloudrepos/official/.git/index.lock’: Permission denied
[natasha@ststor01 official]$ ^C
[natasha@ststor01 official]$ sudo chown -R natasha:natasha /usr/src/kodekloudrepos/official
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:
[natasha@ststor01 official]$ chmod -R u+rw /usr/src/kodekloudrepos/official
[natasha@ststor01 official]$ git checkout master
Already on ‘master’
Your branch is up to date with ‘origin/master’.
[natasha@ststor01 official]$ git pull origin master
fatal: detected dubious ownership in repository at ‘/opt/official.git’
To add an exception for this directory, call:
git config --global --add safe.directory /opt/official.git
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[natasha@ststor01 official]$ ^C
[natasha@ststor01 official]$ git config --global --add safe.directory /opt/official.git
[natasha@ststor01 official]$ sudo chown -R natasha:natasha /opt/official.git
[natasha@ststor01 official]$ cd /opt/official.git
[natasha@ststor01 official.git]$ ^C
[natasha@ststor01 official.git]$ cd /usr/src/kodekloudrepos/official
[natasha@ststor01 official]$ git checkout master
Already on ‘master’
Your branch is up to date with ‘origin/master’.
[natasha@ststor01 official]$ git pull origin master
From /opt/official
- branch master → FETCH_HEAD
Already up to date.
[natasha@ststor01 official]$ git checkout -b devops
Switched to a new branch ‘devops’
[natasha@ststor01 official]$ cp /tmp/index.html .
[natasha@ststor01 official]$ git add index.html
[natasha@ststor01 official]$ git commit -m “Add index.html for devops branch”
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email “[email protected]”
git config --global user.name “Your Name”
to set your account’s default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for [email protected]) not allowed
[natasha@ststor01 official]$ ^C
[natasha@ststor01 official]$ git config --global user.name “Natasha”
[natasha@ststor01 official]$ git config --global user.email “[email protected]”
[natasha@ststor01 official]$ git commit -m “Add index.html for devops branch”
[devops 395a487] Add index.html for devops branch
1 file changed, 1 insertion(+)
create mode 100644 index.html
[natasha@ststor01 official]$ git push -u origin devops
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 350 bytes | 350.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To /opt/official.git
- [new branch] devops → devops
branch ‘devops’ set up to track ‘origin/devops’.
[natasha@ststor01 official]$ git checkout master
Switched to branch ‘master’
Your branch is up to date with ‘origin/master’.
[natasha@ststor01 official]$ git merge devops
Updating 6517b31…395a487
Fast-forward
index.html | 1 +
1 file changed, 1 insertion(+)
create mode 100644 index.html
[natasha@ststor01 official]$ git push origin master
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To /opt/official.git
6517b31…395a487 master → master
[natasha@ststor01 official]$
