I am doing 100 days Devops training and I am stuck on Day 34: Git Hook
Steps I am following
-
vi /opt/apps.git/hooks/post-update
#!/usr/bin/bash
for ref in "$@";
do
if [ "$ref" = "refs/heads/master" ];
then
TAG_NAME="release-$(TZ="America/Chicago" date +%F)"
git tag -a "$TAG_NAME" -m "Automated release for TODAY" "$ref"
echo "Remote: Tag created $TAG_NAME"
fi
done
exec git update-server-info
-
cd /usr/src/kodekloudrepos/apps/
-
git checkout master
-
git merge feature
-
git push
-
Successfully verified created Tag in master branch name.
Everything looks good but I am not able to figure it out what might be the problem! see if anyone is able to come up with the solution… Thank you 
I am doing 100 days Devops training and I am stuck on Day 34: Git Hook
Steps I am following
-
vi /opt/apps.git/hooks/post-update
#!/usr/bin/bash
for ref in "$@";
do
if [ "$ref" = "refs/heads/master" ];
then
TAG_NAME="release-$(TZ="America/Chicago" date +%F)"
git tag -a "$TAG_NAME" -m "Automated release for TODAY" "$ref"
echo "Remote: Tag created $TAG_NAME"
fi
done
exec git update-server-info
-
cd /usr/src/kodekloudrepos/apps/
-
git checkout master
-
git merge feature
-
git push
-
Successfully verified new created Tag in master branch name.
Everything looks good but I am not able to figure it out what might be the problem! see if anyone is able to come up with the solution… Thank you 
I Tried other people’s solution too, which for them it was working fine, but for me it is constantly giving me same error message.
Creating a light-weight tag should work instead of the annotated tag, check the difference between them here.
I’ve seen quite a few users raise similar issue, I guess it is supposed to be specified in the question.
In short creating a tag like below should work.
git tag "$TAG_NAME"
1 Like
Hi Srikanth, Amazing man!!! IT Worked
Party’s on me, where are you located brother, I tried with git tag “$TAG_NAME”, and it worked superb.
1 Like