git常见问题记录

fatal: refusing to merge unrelated histories

git merge origin/druid
fatal: refusing to merge unrelated histories

这里的问题的关键在于:fatal: refusing to merge unrelated histories
你可能会在git pull或者git push中都有可能会遇到,这是因为两个分支没有取得关系。那么怎么解决呢?

在你操作命令后面加–allow-unrelated-histories
例如:

git merge master --allow-unrelated-histories

如果你是git pull或者git push报fatal: refusing to merge unrelated histories
同理:

git pull origin master --allow-unrelated-histories

! [remote rejected] master -> master (shallow update not allowed)

已经习惯git clone --depth 了克隆本地版本。这导致浅克隆。这种克隆的一个局限性是您不能将其从其中推送到新的存储库中。

所以,您想保留您的历史记录,是吗?这意味着您必须解压缩存储库。为此,您将需要再次添加旧的遥控器。

git remote add old <path-to-old-remote>
之后,我们用来git fetch从旧的遥控器中获取剩余的历史记录(如本答案所示)。

git fetch --unshallow old

如果您的仓库是origin,原始仓库是upstream:

git fetch --unshallow upstream

如果获取–unshallow不起作用。您的分支机构一定存在一些问题。在推入之前,请使用以下命令对其进行修复。

git filter-branch -- --all

error: insufficient permission for adding an object to repository database

git pull
remote: Counting objects: 78, done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 78 (delta 60), reused 0 (delta 0)
error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed

git报错

insufficient permission for adding an object to repository database

是因为项目的 .git 目录有些文件夹的权限是root用户,

解决办法,切换到root超级管理员,修改文件所属用户为当前电脑用户

chown -R xxxx: .git
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

死磕音视频

你的打赏是我分享的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值