I just got a new computer, and installed homebrew before restoring my computer with a time machine backup. When I restored it, I changed the main user file name. I think this is causing my problem.
Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Counting objects: 230481, done.
remote: Compressing objects: 100% (60411/60411), done.
remote: Total 230481 (delta 168814), reused 230474 (delta 168810)
Receiving objects: 100% (230481/230481), 52.92 MiB | 744.00 KiB/s, done.
Resolving deltas: 100% (168814/168814), done.
From https://github.com/Homebrew/homebrew
* [new branch] master -> origin/master
error: unable to unlink old 'share/doc/homebrew/Acceptable-Formulae.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Bottles.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Brew-Test-Bot-For-Core-Contributors.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Brew-Test-Bot.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/C++-Standard-Libraries.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Common-Issues-for-Core-Contributors.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Common-Issues.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Custom-GCC-and-cross-compilers.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/External-Commands.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/FAQ.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Formula-Cookbook.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Gems,-Eggs-and-Perl-Modules.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-0.8.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-0.9.3.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-0.9.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-2.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Homebrew-and-Python.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Installation.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Interesting-Taps-&-Branches.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Maintainer-Guidelines.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Press.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Python-for-Formula-Authors.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Querying-Brew.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/README.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/The-brew-command.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Tips-N'-Tricks.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Troubleshooting.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/Xcode.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-tap.md' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-failed-jenkins.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-failed-pr.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-failed-test.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-for-core-contributors-block.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-for-core-contributors-console.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-for-core-contributors-tabs.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-for-core-contributors-trigger.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-passed-jenkins.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-passed-pr.png' (Permission denied)
error: unable to unlink old 'share/doc/homebrew/brew-test-bot-triggered-pr.png' (Permission denied)
fatal: Could not reset index file to revision 'origin/master'.
Failed during: git reset --hard origin/master
This is the error it is giving me. I have already sudo uninstalled the old homebrew, "rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup", changed the file permissions, chowned the file "chown -R $USER on the Library in /usr/local/", moved the old files
cd /usr/local
# Moving old stuff out of the way.
sudo mv -v Library Library.old
# Now run Homebrew install script again.
as suggested in github questions (https://github.com/Homebrew/homebrew/issues/15138). None of this has worked! Ideas??