Resolve Git Merge Conflicts
Task :
Sarah and Max were working on writting some stories which they have pushed to the repository. Max has recently added some new changes and is trying to push them to the repository but he is facing some issues. Below you can find more details:
SSH into storage server using user max and password Max_pass123. Under /home/max you will find the story-blog repository. Try to push the changes to the origin repo and fix the issues. The story-index.txt must have titles for all 4 stories. Additionally, there is a typo in The Lion and the Mooose line where Mooose should be Mouse.
Click on the + button in the top left corner and select option Select port to view on Host 1, enter port 8000 and click on Display Port. You should be able to access the Gitea page. You can login to Gitea server from UI using username sarah and password Sarah_pass123 or username max and password Max_pass123.
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.
Solution :
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 (master)$ git commit On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working directory clean max (master)$ git push Username for 'http://git.stratos.xfusioncorp.com': max Password for 'http://max@git.stratos.xfusioncorp.com': To http://git.stratos.xfusioncorp.com/sarah/story-blog.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'http://git.stratos.xfusioncorp.com/sarah/story-blog.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. max (master)$ git config --global --add user.email max@stratos.xfusioncorp.com max (master)$ git config --global --add user.name max max (master)$ git pull origin master remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. From http://git.stratos.xfusioncorp.com/sarah/story-blog * branch master -> FETCH_HEAD 2541182..24c23f8 master -> origin/master Auto-merging story-index.txt CONFLICT (add/add): Merge conflict in story-index.txt Automatic merge failed; fix conflicts and then commit the result. max (master)$ vi story-index.txt 1. The Lion and the Mouse 2. The Frogs and the Ox 3. The Fox and the Grapes 4. The Donkey and the Dog max (master)$ git add story-index.txt max (master)$ git commit -m "fix typo and merge request" [master b1fb94e] fix typo and merge request max (master)$ git push origin master Username for 'http://git.stratos.xfusioncorp.com': max Password for 'http://max@git.stratos.xfusioncorp.com': Counting objects: 7, done. Delta compression using up to 2 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 1.17 KiB | 0 bytes/s, done. Total 7 (delta 1), reused 0 (delta 0) remote: . Processing 1 references remote: Processed 1 references in total To http://git.stratos.xfusioncorp.com/sarah/story-blog.git 24c23f8..b1fb94e master -> master max (master)$ git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean max (master)$ git pull origin master From http://git.stratos.xfusioncorp.com/sarah/story-blog * branch master -> FETCH_HEAD Already up-to-date. max (master)$ git log commit b1fb94ec581ac6e271a40af00726c0a203419231 Merge: 32a528f 24c23f8 Author: max <max@stratos.xfusioncorp.com> Date: Sun May 2 14:24:29 2021 +0000 fix typo and merge request commit 32a528fd36e35aaee87679cecbf2d2312dfb454c Author: Linux User <max@ststor01.stratos.xfusioncorp.com> Date: Sun May 2 14:15:04 2021 +0000 Added the fox and grapes story commit 24c23f842173aed5ac2b5f7295f96e1e04f65415 Author: sarah <sarah@stratos.xfusioncorp.com> Date: Sun May 2 14:15:03 2021 +0000 Added Index commit 2541182883370e5079e365420973cd130b0d123b Merge: 9d7f3c6 8f5c21b Author: sarah <sarah@stratos.xfusioncorp.com> Date: Sun May 2 14:15:02 2021 +0000 max (master)$