Git错误:[远程拒绝]主->母版(缺少必要的对象) [英] Git Error : [remote rejected] master -> master (missing necessary objects)

查看:518
本文介绍了Git错误:[远程拒绝]主->母版(缺少必要的对象)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用git时遇到了一个令人担忧的问题.

I've a rather worrying problem with git.

几天前,当服务器git蓝屏显示时,我正在进行一些更改. (我们认为这实际上是由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.

我尝试创建一个新目录并克隆到该目录中.以及git stashgit pull --rebasegit stash apply.

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.

我不太确定这里的git的安装方式,我确实知道我们有(很旧的版本)隐藏 Jira ,并以某种方式将其内置于其中.问题是如果服务器对我来说很烦,我什至不知道如何解决它!

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?

感谢您收到任何建议!

值得一提的是,我通常使用 GitHub for Windows 提交更改,并且只有在出现问题时才放到shell中.巧合的是,我们的服务器蓝屏已对此应用程序进行了升级.

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.

我认为它与Windows的GitHub无关,我重新创建了存储库,并可以从git'console'和GitHub应用程序中进行测试更改(添加和删除文件).

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.

推荐答案

因此,当我看到遇到问题的文件是机器崩溃时提交的文件时,我们尝试让别人创建一个小文件.更改并将这些更改提交到系统.

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'.

无论如何,现在如此幸福的日子!我会把这个问题保留下来,因为Google在该问题上的结果很少,也许其他人也有类似的问题.

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.

这篇关于Git错误:[远程拒绝]主->母版(缺少必要的对象)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆