Git 推送失败 - unpack-objects 异常退出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8442695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git push failed - unpack-objects abnormal exit
提问by vlcik
I'm using remote git repository. I successfully commit my files and now I'm trying to push it up to stream.
我正在使用远程 git 存储库。我成功提交了我的文件,现在我正在尝试将其推送到流式传输。
Operation fails with this messasge:
操作失败并显示此消息:
git.exe push --progress "origin" master:master
error: unpack failed: unpack-objects abnormal exit
error: RPC failed; result=18, HTTP code = 200
I use TortoiseGit client on Windows 7.
我在 Windows 7 上使用 TortoiseGit 客户端。
Why am I getting this message? how to recover from this state?
为什么我会收到这条消息?如何从这种状态中恢复?
采纳答案by KL-7
回答by sean_m
If your git repo is self hosted, check the file system rights on the remote git directory. If this gets corrupted, it is possible that your git server just doesn't have rights.
如果您的 git repo 是自托管的,请检查远程 git 目录上的文件系统权限。如果这被破坏了,可能是你的 git 服务器没有权限。
For instance, I host my own gitosis system on Ubuntu server. When I create the git repo on the server, I run sudo git init --bare <repo name>
I then have to run sudo chgrp -R gitosis <repo name> && sudo chown -R gitosis <repo name>
.
例如,我在 Ubuntu 服务器上托管我自己的 gitosis 系统。当我在服务器上创建 git repo 时,我运行sudo git init --bare <repo name>
我然后必须运行sudo chgrp -R gitosis <repo name> && sudo chown -R gitosis <repo name>
.
回答by surfer190
This also occurs when the remote has no space left on it, try free up some space.
当遥控器上没有剩余空间时也会发生这种情况,请尝试释放一些空间。
回答by Sardathrion - against SE abuse
Do check the permissions on the remote/origin repository. Are they writeable by the git user? If not, you will get this error. Something like:
请检查远程/源存储库的权限。它们是否可由 git 用户写入?如果没有,您将收到此错误。就像是:
chown git_user.git_user -R /path/to/repo/your_funky_repo
should do the trick on *nix systems. If your remote is on windows, I am sure there's something equivalent you could run.
应该在 *nix 系统上解决问题。如果你的遥控器在 Windows 上,我相信你可以运行一些等效的东西。
回答by wkd
I encountered this problem when I set up a fresh remote server and created the remote git repo/folders with my root
user (rather than my personal user acct). Problem fixed by deleting the git repos and redoing them with my personal account. all works as expected now.
当我设置一个新的远程服务器并使用我的root
用户(而不是我的个人用户帐户)创建远程 git repo/文件夹时,我遇到了这个问题。通过删除 git 存储库并使用我的个人帐户重做来解决问题。现在一切都按预期工作。
回答by PHZ.fi-Pharazon
On my (gitlab) server, I needed first to chown -R git:git repositories/ , but git repack did not work. The issue was solved when I used scp to copy the object file from my local repo to the server:
在我的(gitlab)服务器上,我首先需要 chown -R git:git repositories/ ,但是 git repack 不起作用。当我使用 scp 将目标文件从本地存储库复制到服务器时,问题得到解决:
scp .git/objects/0d/449dd91d8c20c1820d1284371b28637e08a0f3 root@server:/home/git/repositories/my/project.git/objects/0d/
回答by zatenzu
If you use a HTTP URL, you cannot push data via HTTP. HTTP is for read only access. Use ssh instead.
如果使用 HTTP URL,则无法通过 HTTP 推送数据。HTTP 用于只读访问。请改用 ssh。
Do git remote -v
to check if your repository URL is a HTTP one.
You can change this URL by doing this git remote set-url origin ssh:user@server/dir/project.git
做git remote -v
检查,如果你的版本库URL是一个HTTP之一。您可以通过执行此操作更改此 URLgit remote set-url origin ssh:user@server/dir/project.git
After that, you can push!
之后就可以推了!
回答by hao wangg
I successfully pushed it using "git push —no-thin origin HEAD
"
我成功地使用“ git push —no-thin origin HEAD
”推送了它
Sometimes when we execute git push to push a new branch to a remote repository, it will be blocked by the remote repository.
有时当我们执行 git push 将一个新分支推送到远程仓库时,会被远程仓库阻塞。
Maybe we don't have the appropriate permissions. However, when I add the --no-thin
parameter to git push, I can push it up.
也许我们没有适当的权限。但是,当我将--no-thin
参数添加到 git push 时,我可以将其推高。
However, this command may be affected by different levels of permissions, so there is no guarantee that it will be pushed. But I succeeded with this push.
不过这个命令可能会受到不同级别的权限影响,所以不保证一定会被推送。但是我通过这次推动成功了。
回答by Okneloper
In my case, the remote repo was a shallow clone. I was pushing a merge commit which apparently was using commits dated before the earliest commit the shallow repo had.
就我而言,远程仓库是一个浅层克隆。我正在推动一个合并提交,它显然使用的是在浅仓库最早提交之前的提交。
To fix this you need to unshallow the remote:
git fetch --unshallow
要解决此问题,您需要取消遥控器的浅层:
git fetch --unshallow
回答by Noah Heldman
On Windows, the only fix that worked for me was to remove the following lines from my .gitconfig file:
在 Windows 上,唯一对我有用的修复方法是从我的 .gitconfig 文件中删除以下几行:
[credential]
helper = !'C:\Users\YourNameHere\AppData\Roaming\GitCredStore\git-credential-winstore.exe'
Once I did that, I manually pushed once (successfully), then added the above lines back to .gitconfig, and everything worked.
一旦我这样做了,我手动推了一次(成功),然后将上面的行添加回 .gitconfig,一切正常。