Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Error : [remote rejected] master -> master (missing necessary objects)

I've a rather worrying problem with git.

A few days ago I was committing some changes when the server git was on blue screened. (We think it was actually caused by git.)

Since then I've not been able to commit any changes to the repository, while others can. I can no longer commit changes to the files I was committing when the server crashed, however I can commit changes to other files.

I've tried creating a fresh directory and cloning into it. As well as a git stash, git pull --rebase, git stash apply.

No matter what, the server is returning an error when I now try to commit the files I was committing when the server blue screened:

$ git push -v
Pushing to http://bjury1@server:7990/scm/project.get
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 745 bytes | 0 bytes/s, done.
Total 7 (delta 6), reused 0 (delta 0)
POST git-receive-pack (881 bytes)
To http://bjury1@server:7990/scm/project.get
 ! [remote rejected] master -> master (missing necessary objects)
error: failed to push some refs to 'http://bjury1@server:7990/scm/project.get'

I can commit test changes like adding and removing a file.

I'm not too sure how git is installed here, I do know we have (very old versions of) Stash and Jira and somehow it is built into those. The problem is if the server is borked for me, I'm not even sure how to go about fixing it!

Is there anyway to reset or query the status of a specific file on the server?

Any suggestions gratefully received!

Edit:

It's worth mentioning I normally use GitHub for Windows to commit changes, and only drop to the shell when there are issues. Coincidentally to our server blue screen there was an upgrade to this app.

Edit 2:

I think its unrelated to GitHub for Windows, I recreated the repository and could commit a test change (add and remove a file) from both the git 'console' and the GitHub app.

However, when I try to commit a change to the two files I was committing when the server blew up I get the error above. So the issue is something to do with these specific files on the server.

like image 289
BJury Avatar asked Apr 10 '14 17:04

BJury


1 Answers

So when I saw that the problematic files that I was having problems with were the ones I was committing when the machine crashed, we tried having someone else create a small change and commit those changes to the system.

This worked for them. I could then do a pull for their changes and then I could then commit my changes to the files, getting everything back to how it should be.

So the answer is a simple one, have someone else commit the files into the repository, and pull them back out.

Why this works is a bit of a mystery. Presumably there is something user specific somewhere which was left in a bad state after the crash, so pulling a newer version over resets this 'corruption'.

Anyway, it works now so happy days! I'll leave this up as there was scant results on Google for this problem and maybe someone else has a similar issue.

like image 76
BJury Avatar answered Oct 06 '22 09:10

BJury