I'm trying to do a git commit using a bash script. 
I've setup a cron job to execute this script periodically. Everything works as expected if I execute the script directly. 
For some reason, when the script is invoked from the crontab, the git commit fails. Here's the script :
#!/bin/bash
cd /mnt/ebs2/sitemap
echo "Calling java application to generate sitemap"
java -jar SiteMap-1.0-jar-with-dependencies.jar -i sitemapconfig.xml -o /mnt/ebs2/sitemap/website_sitemaps -url ADSKContentURL
echo "sitemap generation complete.."
cd website_sitemaps
chmod 750 *
echo "Updated file permission, commiting to git..."
git commit -am 'automated weekly update'
git push -u
echo "git commit done..."
cd ..
This is the output from the crontab :
Calling java application to generate sitemap
sitemap generation complete..
Updated file permission, commiting to git...
/mnt/ebs2/sitemap/WeeklyUpdate.sh: line 10: git: command not found
/mnt/ebs2/sitemap/WeeklyUpdate.sh: line 11: git: command not found
git commit done...
As you can see, it fails to execute git commit and git push, which works when the script is run directly.
Here's the crontab entry.
0 2 * * 2 /bin/bash /mnt/ebs2/sitemap/WeeklyUpdate.sh
I'm making sure that both crontab and the script is executed in bash. I'm using CentOS 5.11.
Any pointers will be appreciated.
-Thanks,
Shamik
************ EDITED SOLUTION **************
Based on @CholNhial and @Marc, crontab needs the complete git path to execute the command. I've updated the script to use the full path.
#!/bin/bash
cd /mnt/ebs2/aknsitemap
echo "Calling java application to generate sitemap"
java -jar ADSKSiteMap-1.0-jar-with-dependencies.jar -i sitemapconfig_Elvis.xml -o /mnt/ebs2/aknsitemap/aknwebsite_sitemaps -url ADSKContentURL
echo "sitemap generation complete.."
cd aknwebsite_sitemaps
chmod 750 *
echo "Updated file permission, commiting to git..."
/usr/local/bin/git commit -am 'automated weekly update'
/usr/local/bin/git push -u
echo "git commit done..."
cd ..
 
     
    