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

1

7

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.

Those answered 10/4, 2014 at 17:11 Comment(2)
Since others are able to push into the server, the problem has to be with your clone, and not the copy on the server. When re-cloning, did you clone it on your machine?Integrity
@mu無 Many thanks for your help. Yes, I did clone it to my machine, but to a new directory which should rule out it being a local issue, shouldn't it? Note, it was the server which blue screened when I was committing, so my assumption is something there is broken...Those
T
3

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.

Those answered 11/4, 2014 at 10:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.