From c26c5c7855e419a49204e7d4b5cf3a681851f666 Mon Sep 17 00:00:00 2001 From: tekkub Date: Mon, 25 Jan 2010 13:22:04 -0700 Subject: Fix up egit guide for the new default branch setting --- _posts/2009-11-16-egit-corruption.markdown | 51 ++++++++++++++++++++++++++++++ _posts/2009-11-16-egit-corruption.textile | 44 -------------------------- 2 files changed, 51 insertions(+), 44 deletions(-) create mode 100644 _posts/2009-11-16-egit-corruption.markdown delete mode 100644 _posts/2009-11-16-egit-corruption.textile (limited to '_posts') diff --git a/_posts/2009-11-16-egit-corruption.markdown b/_posts/2009-11-16-egit-corruption.markdown new file mode 100644 index 0000000..7426c8b --- /dev/null +++ b/_posts/2009-11-16-egit-corruption.markdown @@ -0,0 +1,51 @@ +--- +layout: default +title: Fixing egit corruption +description: How to fix corruption in a remote repo caused by egit +categories: troubleshooting +--- + +Due to a bug in egit's impementation of the `git push` command, remote repos can become corrupted due to missing objects: + +
$ git fsck
+broken link from  commit 5b90a930763c442f0fc3d819685083b4eda69f8e
+              to  commit e1ea55d308b7808cb982f509c8dfa199ada4677e
+missing commit e1ea55d308b7808cb982f509c8dfa199ada4677e
+ +This can prevent cloning and fetching from the repo. The objects were never pushed to the remote repo, therefore support cannot recover the repo directly for the user. The only solution is for the user that pushed the commits to push them again from the command line. + +Correcting the remote repo +-------------------------- + +To correct the remote repo the missing objects need to be re-pushed from an uncorrupted repo. This should be done from the command line, not from egit. To start, run `git fsck` on your local repo to ensure it has not been corrupted. If you do not receive any errors about broken links or missing objects, you're clear to continue. + +Re-pushing is a simple matter of deleting the remote branch and then pushing it again. If the branch being deleted is the default branch on the remote you'll need to replace it temporarily. We'll use the first commit in the branch so that we can ensure all the other commits are re-pushed. + +
$ git log --pretty=oneline | tail -n 1 # Find the first commit
+3b70d98cb968fc35f0c99acfe4d5dfa976ed2536 Initial commit
+$ git branch temp_default 3b70d98cb968fc35f0c99acfe4d5dfa976ed2536
+$ git push origin temp_default
+$ git remote set-head origin temp_default # Change the remote default branch
+$ git push origin :master
+$ git push origin master
+$ git remote set-head origin master # Set things back to master
+$ git push origin :temp_default
+ +You may need to do this for many branches if the remote repo has more than one branch that was pushed by egit. You can skip `git remote set-head` for these other branches. + +After you've pushed and reset HEAD, testing the repo repo is just a matter of cloning it: + +
$ git clone git://github.com/tekkub/test.git
+Initialized empty Git repository in /Users/tekkub/tmp/test/.git/
+remote: Counting objects: 1815, done.
+remote: Compressing objects: 100% (838/838), done.
+remote: Total 1815 (delta 1139), reused 1552 (delta 961)
+Receiving objects: 100% (1815/1815), 537.69 KiB | 549 KiB/s, done.
+Resolving deltas: 100% (1139/1139), done.
+ +If you have re-pushed all branches in your repo and cloning still fails, please "contact support":http://support.github.com and open a ticket. Be sure to include a link to your repo and mention that you've already performed the steps on this page. + +Avoiding future corruption +-------------------------- + +We recommend users avoid using egit to push their repos. Always push from the command line. \ No newline at end of file diff --git a/_posts/2009-11-16-egit-corruption.textile b/_posts/2009-11-16-egit-corruption.textile deleted file mode 100644 index 7d8343c..0000000 --- a/_posts/2009-11-16-egit-corruption.textile +++ /dev/null @@ -1,44 +0,0 @@ ---- -layout: default -title: Fixing egit corruption -description: How to fix corruption in a remote repo caused by egit -categories: troubleshooting ---- - -Due to a bug in egit's impementation of the @git push@ command, remote repos can become corrupted due to missing objects: - -
$ git fsck
-broken link from  commit 5b90a930763c442f0fc3d819685083b4eda69f8e
-              to  commit e1ea55d308b7808cb982f509c8dfa199ada4677e
-missing commit e1ea55d308b7808cb982f509c8dfa199ada4677e
- -This can prevent cloning and fetching from the repo. The objects were never pushed to the remote repo, therefore support cannot recover the repo directly for the user. The only solution is for the user that pushed the commits to push them again from the command line. - -h2. Correcting the remote repo - -To correct the remote repo the missing objects need to be re-pushed from an uncorrupted repo. This should be done from the command line, not from egit. To start, run @git fsck@ on your local repo to ensure it has not been corrupted. If you do not receive any errors about broken links or missing objects, you're clear to continue. - -Re-pushing is a simple matter of deleting the remote branch and then pushing it again. - -
$ git push origin :master
-$ git push origin master
- -You may need to do this for many branches if the remote repo has more than one branch that was pushed by egit. If one of the branches that was re-pushed was the default branch (usually master), you'll need to re-establish that default: - -
$ git remote set-head origin master
- -After you've pushed and reset HEAD, testing the repo repo is just a matter of cloning it: - -
[tekkub@tekBook: ~/tmp] $ git clone git://github.com/tekkub/test.git
-Initialized empty Git repository in /Users/tekkub/tmp/test/.git/
-remote: Counting objects: 1815, done.
-remote: Compressing objects: 100% (838/838), done.
-remote: Total 1815 (delta 1139), reused 1552 (delta 961)
-Receiving objects: 100% (1815/1815), 537.69 KiB | 549 KiB/s, done.
-Resolving deltas: 100% (1139/1139), done.
- -If you have re-pushed all branches in your repo and cloning still fails, please "contact support":http://support.github.com and open a ticket. Be sure to include a link to your repo and mention that you've already performed the steps on this page. - -h2. Avoiding future corruption - -We recommend users avoid using egit to push their repos. Always push from the command line. \ No newline at end of file -- cgit v1.3.1