Android Studio crashed now can't push to GitHub

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.


  • Private Git Forking Workflow and Collaborative Features
  • “git reset --hard HEAD” in master branch deleted unstaged changes in local branch
  • Remote Pushurl won't work
  • could not read Username for '': No such device or address
  • unable to see recent commits on remote git repo
  • How do I push an entire project to a specific folder in one of my GitHub repositories?
  • Git rollback then step forward in commits
  • Github: Permission denied (publickey) but I got “You've successfully authenticated” message
  • One Solution collect form web for “Android Studio crashed now can't push to GitHub”

    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:

    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

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

    6. rm .git/refs/remotes/origin/master: removed this file. From

    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

    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.

    Git Baby is a git and github fan, let's start git clone.