100 Days of Devops Day 34: Git Hook

Hi team, I think I have done the task correctly and i got the expected output of task Day 34. I have tried multiple time but every time system says that my anser is not corrct. I am not sure, what is the issue.
Screenshot_9

Hey @suzaman

I was stuck for about 3 days on this task alone. So I hope I can help.

Here’s a few things to make sure that you’re doing the right thing (just cos your request doesn’t contain a lot of detail, let’s ensure you have the following down):

  1. Make sure that your hook is setup on your bare repo (i.e. /opt/official.git or whatever the question throws at you)
  2. Here’s a snippet of the git hook that worked for me:
#My question was on /opt/media.git folder so-- /opt/media.git/hooks/post-update

#!/usr/bin/sh

# Arguments to post-update
DATE=$(date +%F)        # YYYY-MM-DD
GIT_DIR=$(pwd)

        echo "Creating tag release-$DATE"
        git --git-dir="$GIT_DIR" tag "release-$DATE" master

and rememember to make the file executable chmod +x /opt/media.git/hooks/post-update

  1. In this post, I outline what had me stuck for a few days. I was tagging the release but also forcing the tag unto subsequent commits (cos I was worried that the system would attempt to commit and get a failure). I now believe that I was marked wrong cos I did a git tag -f…

  2. change dir into your working directory (in my case it was: cd /usr/src/kodekloudrepos/media
    You should be on the “feature branch”, so switch to “master”

git checkout master
git merge feature
git push

Please let me know if any of that helped.

cheers.

1 Like

hi @olakunlecrown28 ,

I had the same problem mentioned in the thread. i added -f option. after deleting -f option, its done. Thanks for helping me.

Awesome,

Glad it helped.

Cheers.

It will be work if user git push instead of git push origin master.

you can check this : it contains the solution of Day 34 100-Days-Of-DevOps-KodeKloud-Challenges-Solutions

Oh, okay, I’ll try that too. thanks.