git 求助: rebase 之后无法 push 到服务器

2015-11-12 17:12:00 +08:00
 oska874

在 master 分支上面有 N 个 commit ,现在要把这些 commit 合并为一个,我就用git rebase -i 23364d 把这些 commit 合并了,然后再往服务器 push ,结果就报错

Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 665 bytes | 0 bytes/s, done.
Total 2 (delta 0), reused 1 (delta 0)
remote: error: insufficient permission for adding an object to repository database objects
remote: fatal: failed to write object 33a66d58ac89fb134a8fcaeaf671b233de675924
error: unpack failed: unpack-objects abnormal exit
To http://192.168.0.111:8080/release.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'http://192.168.0.111:8080/release.git'

然后我就照着 so 上面有人的答案git repack master 之后再 push ,还是一样的错误,没办法 push 到服务器,这个怎么解决?

4381 次点击
所在节点    git
12 条回复
jyjmrlk
2015-11-12 17:16:38 +08:00
git push -f 呢?
daniellu
2015-11-12 17:18:22 +08:00
最好不要-f 强推就算成功了 可能代码就有问题了
git status 一下看看
oska874
2015-11-12 17:19:18 +08:00
@daniellu Your branch is ahead of 'origin/master' by 2 commits.
daniellu
2015-11-12 17:19:56 +08:00
没有其它的信息吗?@oska874
oska874
2015-11-12 17:21:46 +08:00
@daniellu 没了, clean 。问题得是“ remote: fatal: failed to write object 33a66d58ac89fb134a8fcaeaf671b233de675924 ” 服务器上没有 33a66d58ac89fb134a8fcaeaf671b233de675924 这个提交。
mok502
2015-11-12 17:22:34 +08:00
remote: error: insufficient permission for adding an object to repository database objects

Git 服務器權限問題。
oska874
2015-11-12 17:38:06 +08:00
@mok502 的确是这个问题,中间重启过一次服务器,结果。。。现在 gitlab 添加的用户没办法操作 repo 所在的目录了。。。
ivyshark
2015-11-12 17:55:59 +08:00
@daniellu force-with-lease 不是安全的么
luoluoluo
2015-11-12 18:37:46 +08:00
似乎我 13 年的时候遇到过,好久没用 git 了,从我经久失修的博客里貌似有办法

http://lf2013.github.io/tools/skill/2013/08/08/gitnote/

博客 N 就没管了,乱码、排版什么的请无视,重在解决问题
bingwenshi
2015-11-12 18:41:44 +08:00
你没有理解 rebase 的原理, rebase 本身就是调整 branch 上的 commits ,所以肯定是要 push -f 的
yangg
2015-11-12 19:45:35 +08:00
push -f , gitlab 用户权限那里要有“+”号。
+rw 类似这样
oska874
2015-11-13 01:45:14 +08:00
@bingwenshi 最后没加 -f 正常提交了
@yangg 我的情况比较复杂,是用用户 git 挂载了一个磁盘才能正常读写的,不需要用户 gitlab

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/235695

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX