- 1. 概要
- 2. 現象
- 3. 状況
- 4. 対処
- 5. 参考サイト
1. 概要
「FreeBSD 15.0 RELEASE」を「FreeBSD 15.1 RELEASE」へアップグレードしたもので、2台あるのですが、どちらも同じ現象です。
2. 現象
「ports」を更新しようと。
git -C /usr/ports pull
すると。
remote: Enumerating objects: 10798, done.
remote: Counting objects: 100% (7710/7710), done.
remote: Compressing objects: 100% (2066/2066), done.
remote: Total 3445 (delta 1857), reused 2855 (delta 1355), pack-reused 0 (from 0)
Receiving objects: 100% (3445/3445), 1.47 MiB | 4.44 MiB/s, done.
Resolving deltas: 100% (1857/1857), completed with 675 local objects.
From https://git.FreeBSD.org/ports
+ 0a717e9c11...9f760ea4ed main -> origin/main (forced update)
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
*** Error code 128
Stop.
となります。
3. 状況
この状況を「Gemini」伍長に解説してもらうと。
git pull を実行した際、ローカルのブランチとリモート(origin/main)の履歴が分岐してしまっているためにエラーが発生しています。
FreeBSDの ports ツリーは基本的に読み取り専用として運用し、アップストリーム(origin/main)の状態にローカルを強制追従させるのが最も安全で確実です。
とのこと。
4. 対処
ローカルで独自にコミットを作成していない限り、以下の方法で解消できます。
ということで。
わたしは、ローカルでは、「pull」するだけなので。
ローカルの変更を破棄してリモートの最新状態に合わせます。
git -C /usr/ports fetch origin
git -C /usr/ports reset --hard origin/main
こうしておいて、以降、同じエラーを出さないために「pull.ff only」 fast-forward のみ許可)を設定しておくのが望ましいとのこと。
git -C /usr/ports config pull.ff only
これで、通常状態に戻ったようです。
5. 参考サイト
本ページは、「Gemini」伍長を参考にさせていただきました。
|
|