git status
outputs the following:
# On branch master
error: corrupt loose object '1e2dc6d8b6eec682f3ecc9dd879445fea5d6a34d'
fatal: loose object 1e2dc6d8b6eec682f3ecc9dd879445fea5d6a34d (stored in .git/objects/1e/2dc6d8b6eec682f3ecc9dd879445fea5d6a34d) is corrupt
I have 12 non pushed commits. I can see them in git log
.
Is there any hope to push them?
git push
outputs:
error: corrupt loose object '1e2dc6d8b6eec682f3ecc9dd879445fea5d6a34d'
fatal: loose object 1e2dc6d8b6eec682f3ecc9dd879445fea5d6a34d (stored in .git/object/1e/2dc6d8b6eec682f3ecc9dd879445fea5d6a34d) is corrupt
error: failed to push some refs to 'git@bitbucket.com:username/reponame.git'
Before having these corrupted files I run:
find . -type f -print0 | xargs -0 sed -i 's/\s\+$//g'
(in the git repo directory)
This affected the .git
files.
Update: I tried the VonC's suggestion running the following commands:
cd ~
$ git clone git@bitbucket.org:username/reponame.git
Cloning into 'reponame'...
remote: Counting objects: 1561, done.
remote: Compressing objects: 100% (853/853), done.
remote: Total 1561 (delta 966), reused 1067 (delta 642)
Receiving objects: 100% (1561/1561), 223.80 KiB | 94.00 KiB/s, done.
Resolving deltas: 100% (966/966), done.
Checking connectivity... done
$ cd reponame/
$ $ git remote add yourLocalRemoteName /home/user/corupted/git/repository/folder
$ git pull yourLocalRemoteName
fatal: attempt to fetch/clone from a shallow repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.