Brew Update Errors Fixed

I met several errors while updating my homebrew, one is:

the solution is:

1
2
3
4
cd `brew --prefix`
git remote add origin https://github.com/mxcl/homebrew.git
git fetch origin
git reset --hard origin/master

the other is:

To address this this error, we just have have to change the permissions on the folder to a certain user:

1
chown -R sun .git