gpt4 book ai didi

git - 错误 : --mirror can't be combined with refspecs

转载 作者:行者123 更新时间:2023-12-03 18:30:53 24 4
gpt4 key购买 nike

我镜像了一个 git 存储库并删除了 application.properties包含来自 MyProject 的密码存储库。我可以看到 Deleted files 下的消息和我的文件名如下:

$ java -jar bfg-1.13.0.jar --delete-files application.properties --no-blob-protection MyProject.git

Using repo : \\hnas1-users\USERS\dan\Desktop\bfg_test_after_delete\MyProject.git

Found 0 objects to protect
Found 4 commit-pointing refs : HEAD, refs/heads/Single_home_page, refs/heads/Second_home_page, refs/heads/master

Protected commits
-----------------
You're not protecting any commits, which means the BFG will modify the contents of even *current* commits.
This isn't recommended - ideally, if your current commits are dirty, you should fix up your working copy and commit that, check that your build still works, and only then run the BFG to clean up your history.

Cleaning
--------

Found 862 commits
Cleaning commits: 100% (862/862)
Cleaning commits completed in 99,796 ms.

Updating 3 Refs
---------------

Ref Before After
---------------------------------------------------
refs/heads/Single_home_page | 7e099f8c | d4fa8bdc
refs/heads/Second_home_page | 0145da48 | 1b9b1ca2
refs/heads/master | 0e8ac08e | 502363b0

Updating references: 100% (3/3)
...Ref update completed in 393 ms.

Commit Tree-Dirt History
------------------------

Earliest Latest
| |
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

D = dirty commits (file tree fixed)
m = modified commits (commit message or parents changed)
. = clean commits (no changes to file tree)

Before After
-------------------------------------------
First modified commit | 5a303ff3 | 0280ae15
Last dirty commit | 7e099f8c | d4fa8bdc

Deleted files
-------------

Filename Git id
-----------------------------------------------------------------
application.properties | c5e94e15 (2.3 KB), b8f324fd (887 B), ...

我有以下问题和问题:

我已经使用来自 Single_home_page 的 git mirror 克隆了我的代码存储库和因为有 4 个提交指向的引用,如上所示,它们是 HEAD, refs/heads/Single_home_page, refs/heads/Second_home_page, refs/heads/master , 我想确保在删除上述文件后,我将更改推送到 Single_home_page仅存储库。为此,我尝试执行以下操作:
git push origin Single_home_pagegit push --set-upstream origin Single_home_page
两种情况都出现以下错误:
error: --mirror can't be combined with refspecs
我在这里做错了什么?

================================================== ====================

按照 brian 回答中提到的步骤,于 3 月 17 日更新:

按照步骤操作后,我得到以下信息:
 git push origin Single_home_page
To http://<path to git repo>/MyProject.git
! [rejected] Single_home_page -> Single_home_page (non-fast-forward)
error: failed to push some refs to 'http://<path to git repo>/MyProject.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

使用后 +对于我的分支:
 $ git push origin +Single_home_page
Counting objects: 10089, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4439/4439), done.
Writing objects: 100% (10089/10089), 32.84 MiB | 6.27 MiB/s, done.
Total 10089 (delta 5475), reused 6793 (delta 4329)
To http://<path to MyProject>/MyProject.git
+ 7e099f8...d4fa8bd Single_home_page -> Single_home_page (forced update)

最佳答案

既然你说你镜像了存储库,那么这里可能发生的是配置选项 remote.origin.mirror设置。您可以通过运行 git config remote.origin.mirror 来确认这一点。 ,它会告诉你 true如果设置了。

在这种情况下,最简单的方法是运行 git config --unset remote.origin.mirror关闭此选项,然后再次尝试推送。不幸的是,没有一个有用的 --no-mirror为您关闭此功能的选项。

关于git - 错误 : --mirror can't be combined with refspecs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49325013/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com