1

This morning AS crashed on statup. I rebooted and it seemed to startup fine. However, when I try to commit and push to GitHub via AS I get an Internal IDE error. I've tracked down a range of errors but am unsure what they mean and how to fix them:

  • AS IDE error: collectInfoToPush | Couldn't collect commits to push....fatal: bad revision 'origin/master..master'
  • cmd line: git status: Your branch is based on 'origin/master', but the upstream is gone.
  • cmd line: git fsck: error: bad ref for refs/remotes/origin/master: dangling blob 0d40b3eceae21f1bfdd851fe137a40a3fd624437......(many of these)

I apologise I don't know much about git other than the very basics. I'm guessing that somehow my local repo lost tracking with my repo on GitHub when AS crashed. Any suggestions anyone has would be greatly appreciated.

Thanks, Riz

chdryra
  • 523
  • 5
  • 17
  • Have you tested en command line with Git Bash ? – Hann Feb 24 '15 at 17:17
  • I ran the commands above *"git status" and "git fsck" both in an AS terminal and in Git Bash with the same results. – chdryra Feb 24 '15 at 17:21
  • The accepted answer of [this thread](http://stackoverflow.com/questions/21609781/why-call-git-branch-unset-upstream-to-fixup) provides a lot of useful information related to your case. – Ha Dang Feb 24 '15 at 17:49
  • Thanks. I did look through that before but was hoping for some "easy" solution involving AS rather than command line (I have very little patience for command line stuff!). Will look through it again. – chdryra Feb 25 '15 at 10:20

1 Answers1

1

Ok after some help from the comments I have got git to work again from Git Bash and from AS. I did the following:

  1. git status: says my upstream is gone.

  2. Read this to understand git jargon better: https://stackoverflow.com/a/21616241/2815375

  3. git branch --unset-upstream: to remove the reference to upstream. Gets rid of the error message. From same link.

  4. git gc --prune=now: I pruned all dead files. From https://stackoverflow.com/a/7614419/2815375

  5. This gave me an error saying my origin/master was bad.

  6. rm .git/refs/remotes/origin/master: removed this file. From https://stackoverflow.com/a/15458951/2815375

  7. Did step 4) again. Everything fine now.

  8. git remote show origin: to ensure remote properly defined.

  9. git push --set-upstream origin master: to ensure proper tracking and everything synced up to date. From https://stackoverflow.com/a/12694311/2815375

  10. git status: "your branch is up to date with origin.master"

  11. However still didn't work in Android Studio. Realised I has to do it for every submodule.

  12. Do this for every submodule

  13. Everything works in AS now too.

Hope this helps.

Community
  • 1
  • 1
chdryra
  • 523
  • 5
  • 17