Git Level4: Git Setup from Scratch

I successfully created the hook and direct push to master was blocked by the hook.But the at when i try to submit my work i got this error message:

- '/opt/games.git' git repository on storage server is not a bare repository

I’m certain that I created bare repository at /opt/games.git
here is the commands i used :

ssh natasha@ststor01

sudo yum install -y git

git config --global user.email "[email protected]"
git config --global user.name "testuser"
cd /opt/games.git
git init --bare
cp /tmp/update /opt/games.git/hooks/
chmod +x /opt/games.git/hooks/update
cd /usr/src/kodekloudrepos
git clone /opt/games.git games
cd games
git checkout -b xfusioncorp_games
cp /tmp/readme.md .
git add readme.md
git commit -m "Added readme.md"

git push origin xfusioncorp_games

Tried push directly to master to check if it fails due the hook

git checkout -b master 
git push origin master

Hi @Tharun_Umesh

When you start, ensure that the /opt/games.git directory exists.
You need to create the dir and then start the process of initializing the bare repo.

@Santosh_KodeKloud I did it again and created the directory before initializing the bare repo.

Before submitting my work I checked if the repository is bare,using this command:

sudo git --git-dir=/opt/ecommerce.git rev-parse --is-bare-repository

And the output is true(You can see it in the screenshot as well),But the result is still same :confused:

Probably what you have wrong here is how you created the origin, bare repo. The command should be:

git init --bare /opt/ecommerce.git

I ran this as root, and also cloned the repo as root; I changed the user to be “natasha” after I committed the readme.md file to the branch. The grader accepted this.