100 days of devops Day 25 issue : Git merge

100 days of devops Day 25 issue. Git merge. Task getting failed. Please review the same. I have attached the steps below please look into it.

[natasha@ststor01 ~]$ cd /usr/src/kodekloudrepos/beta
[natasha@ststor01 beta]$ ls
info.txt welcome.txt
[natasha@ststor01 beta]$ sudo chown -R natasha:natasha /usr/src/kodekloudrepos/beta

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 beta]$ git branch

  • master
    [natasha@ststor01 beta]$ git branch devops
    [natasha@ststor01 beta]$ pwd
    /usr/src/kodekloudrepos/beta
    [natasha@ststor01 beta]$ git branch
    devops
  • master
    [natasha@ststor01 beta]$ git checkout devops
    Switched to branch ‘devops’
    [natasha@ststor01 beta]$ ls
    info.txt welcome.txt
    [natasha@ststor01 beta]$ cp /tmp/index.html .
    [natasha@ststor01 beta]$ ls
    index.html info.txt welcome.txt
    [natasha@ststor01 beta]$ git status
    On branch devops
    Untracked files:
    (use “git add …” to include in what will be committed)
    index.html

nothing added to commit but untracked files present (use “git add” to track)
[natasha@ststor01 beta]$ git add .
[natasha@ststor01 beta]$ git status
On branch devops
Changes to be committed:
(use “git restore --staged …” to unstage)
new file: index.html

[natasha@ststor01 beta]$ git commit -m “first commit”
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 beta]$ git config --global user.email “[email protected]
[natasha@ststor01 beta]$ git config --global user.name “Your Name”
[natasha@ststor01 beta]$ git commit -m “first commit”[devops b213f4d] first commit
1 file changed, 1 insertion(+)
create mode 100644 index.html
[natasha@ststor01 beta]$ ls
index.html info.txt welcome.txt
[natasha@ststor01 beta]$ git checkout master
Switched to branch ‘master’
Your branch is up to date with ‘origin/master’.
[natasha@ststor01 beta]$ git branch
devops

  • master
    [natasha@ststor01 beta]$ git merge devops
    Updating d534367…b213f4d
    Fast-forward
    index.html | 1 +
    1 file changed, 1 insertion(+)
    create mode 100644 index.html
    [natasha@ststor01 beta]$ ls
    index.html info.txt welcome.txt
    [natasha@ststor01 beta]$ git branch
    devops

  • master
    [natasha@ststor01 beta]$ git remote -v
    origin /opt/beta.git (fetch)
    origin /opt/beta.git (push)
    [natasha@ststor01 beta]$ git branch -r
    origin/master
    [natasha@ststor01 beta]$ git push origin master
    fatal: detected dubious ownership in repository at ‘/opt/beta.git’
    To add an exception for this directory, call:

      git config --global --add safe.directory /opt/beta.git
    

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[natasha@ststor01 beta]$ sudo chown -R natasha:natasha /opt/beta.git
[sudo] password for natasha:
[natasha@ststor01 beta]$ git push origin master
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), 331 bytes | 331.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To /opt/beta.git
d534367…b213f4d master → master
[natasha@ststor01 beta]$ git push origin devops
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To /opt/beta.git

  • [new branch] devops → devops
    [natasha@ststor01 beta]$ git remote -v
    origin /opt/beta.git (fetch)
    origin /opt/beta.git (push)
    [natasha@ststor01 beta]$ git branch -r
    origin/devops
    origin/master
    [natasha@ststor01 beta]$ git show origin/master:index.html
    Welcome to Nautilus Group !
    [natasha@ststor01 beta]$ git show origin/devops:index.html
    Welcome to Nautilus Group !
    [natasha@ststor01 beta]$ pwd
    /usr/src/kodekloudrepos/beta
    [natasha@ststor01 beta]$ git branch
    devops
  • master
    [natasha@ststor01 beta]$

Hi @sandeepchoudhary04

You need to become root in the Storage server and then operate on the repo.

You can refer to this solution.

100 days of devops Day 25 issue. Git merge. Task getting failed. Please review the same. I have attached the steps below please look into it.

[natasha@ststor01 ~]$ cd /usr/src/kodekloudrepos/beta
[natasha@ststor01 beta]$ ls
info.txt welcome.txt
[natasha@ststor01 beta]$ sudo chown -R natasha:natasha /usr/src/kodekloudrepos/beta

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 beta]$ git branch

  • master
    [natasha@ststor01 beta]$ git branch devops
    [natasha@ststor01 beta]$ pwd
    /usr/src/kodekloudrepos/beta
    [natasha@ststor01 beta]$ git branch
    devops
  • master
    [natasha@ststor01 beta]$ git checkout devops
    Switched to branch ‘devops’
    [natasha@ststor01 beta]$ ls
    info.txt welcome.txt
    [natasha@ststor01 beta]$ cp /tmp/index.html .
    [natasha@ststor01 beta]$ ls
    index.html info.txt welcome.txt
    [natasha@ststor01 beta]$ git status
    On branch devops
    Untracked files:
    (use “git add …” to include in what will be committed)
    index.html

nothing added to commit but untracked files present (use “git add” to track)
[natasha@ststor01 beta]$ git add .
[natasha@ststor01 beta]$ git status
On branch devops
Changes to be committed:
(use “git restore --staged …” to unstage)
new file: index.html

[natasha@ststor01 beta]$ git commit -m “first commit”
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 beta]$ git config --global user.email “[email protected]
[natasha@ststor01 beta]$ git config --global user.name “Your Name”
[natasha@ststor01 beta]$ git commit -m “first commit”[devops b213f4d] first commit
1 file changed, 1 insertion(+)
create mode 100644 index.html
[natasha@ststor01 beta]$ ls
index.html info.txt welcome.txt
[natasha@ststor01 beta]$ git checkout master
Switched to branch ‘master’
Your branch is up to date with ‘origin/master’.
[natasha@ststor01 beta]$ git branch
devops

  • master
    [natasha@ststor01 beta]$ git merge devops
    Updating d534367…b213f4d
    Fast-forward
    index.html | 1 +
    1 file changed, 1 insertion(+)
    create mode 100644 index.html
    [natasha@ststor01 beta]$ ls
    index.html info.txt welcome.txt
    [natasha@ststor01 beta]$ git branch
    devops

  • master
    [natasha@ststor01 beta]$ git remote -v
    origin /opt/beta.git (fetch)
    origin /opt/beta.git (push)
    [natasha@ststor01 beta]$ git branch -r
    origin/master
    [natasha@ststor01 beta]$ git push origin master
    fatal: detected dubious ownership in repository at ‘/opt/beta.git’
    To add an exception for this directory, call:

      git config --global --add safe.directory /opt/beta.git
    

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[natasha@ststor01 beta]$ sudo chown -R natasha:natasha /opt/beta.git
[sudo] password for natasha:
[natasha@ststor01 beta]$ git push origin master
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), 331 bytes | 331.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To /opt/beta.git
d534367…b213f4d master → master
[natasha@ststor01 beta]$ git push origin devops
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To /opt/beta.git

  • [new branch] devops → devops
    [natasha@ststor01 beta]$ git remote -v
    origin /opt/beta.git (fetch)
    origin /opt/beta.git (push)
    [natasha@ststor01 beta]$ git branch -r
    origin/devops
    origin/master
    [natasha@ststor01 beta]$ git show origin/master:index.html
    Welcome to Nautilus Group !
    [natasha@ststor01 beta]$ git show origin/devops:index.html
    Welcome to Nautilus Group !
    [natasha@ststor01 beta]$ pwd
    /usr/src/kodekloudrepos/beta
    [natasha@ststor01 beta]$ git branch
    devops
  • master
    [natasha@ststor01 beta]$

Thanks for your help Santosh_KodeKloud. Could you please tell me why to become root in the storage server. Why it’s not working with normal user after changing the ownership of user?