I have this problem too, because I deleted my Xcode.
I solved this with the following steps:
Type xcode-select --install in terminal (install license)
Download git and reinstall it
After these two steps, I can use the git commands in the terminal, for example git or git --version .
But when I open android studio, it still shows error
so we need two more steps:
Enter which git in your terminal (find out the git path)
Set up the path (you got in step 3) in your Android studio, then apply
As below pic. 
It works for me.
Allen Nov 23 '16 at 11:18 2016-11-23 11:18
source share