I started to using subtree but ended in mess now. Googling and the man page didn't help that I can find out how to solve this error. Anyone an idea?
Error:
➜ git subtree split -P gitkraken --rejoin
cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!
Example to reproduce it, externally.
mkdir test
cd test
git init
touch readme.md
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git add readme.md
git commit -m "add readme"
git subtree add --prefix gitkraken "aur@aur.archlinux.org:gitkraken.git" master
git subtree split -P "gitkraken" --rejoin
Currently, in my repo I switched the folder to gitkraken-aur
and so it works for the moment again.
Attempt from the first answer to remove the subtree folder.
test on main [?]
➜ rm -rf .git/subtree-cache
test on main [?]
➜ git subtree split -P "gitkraken" --rejoin
cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!
test on main [?]
➜ git subtree pull -P gitkraken "aur@aur.archlinux.org:gitkraken.git" master -m "Merge subbtree gitkraken"
From aur.archlinux.org:gitkraken
* branch master -> FETCH_HEAD
Already up to date.
test on main [?]
➜ git subtree push -P gitkraken "aur@aur.archlinux.org:gitkraken.git" master
git push using: aur@aur.archlinux.org:gitkraken.git master
cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!
test on main [?]
➜ rm -rf .git/subtree-cache
test on main [?]
➜ git subtree push -P gitkraken "aur@aur.archlinux.org:gitkraken.git" master
git push using: aur@aur.archlinux.org:gitkraken.git master
cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!
More debug information to attempt one.
test on main [?]
➜ rm -rf .git/subtree-cache
test on main [?]
➜ tree .git
.git
├── COMMIT_EDITMSG
├── FETCH_HEAD
├── HEAD
├── ORIG_HEAD
├── branches
├── config
├── description
├── hooks
│ ├── applypatch-msg.sample
│ ├── commit-msg.sample
│ ├── fsmonitor-watchman.sample
│ ├── post-update.sample
│ ├── pre-applypatch.sample
│ ├── pre-commit.sample
│ ├── pre-merge-commit.sample
│ ├── pre-push.sample
│ ├── pre-rebase.sample
│ ├── pre-receive.sample
│ ├── prepare-commit-msg.sample
│ ├── push-to-checkout.sample
│ └── update.sample
├── index
├── info
│ └── exclude
├── logs
│ ├── HEAD
│ └── refs
│ └── heads
│ └── main
├── objects
│ ├── 0c
│ │ └── ce20ac9c41edfaafd245059b066f4e644b6c84
│ ├── 23
│ │ └── 9ec593c6a2192e76c005435f748b2ad28be832
│ ├── 69
│ │ └── 3d7dd0cbe326ad51fffad7408c2c6cc8af7e0d
│ ├── 74
│ │ └── 11ec84b161eba98f6ae09d2210c231393c977c
│ ├── 84
│ │ └── a5dcf23e618a493da589f95f2c57da22603e2a
│ ├── 99
│ │ └── 03d6d6b962b96143f3e2c0b75550561de14c06
│ ├── b3
│ │ └── 5caa9cbb57f55fb05260b3dd767f92c62a20ba
│ ├── bf
│ │ └── 52649a7b94057b0da0a7f1bb20c55b395717be
│ ├── e4
│ │ └── 22b2b19b0c80773ccbad0822130158a024ef59
│ ├── e6
│ │ └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│ ├── eb
│ │ └── 4c7f2ebf6596f7e3c40b2355bc11e7a1badf58
│ ├── info
│ └── pack
│ ├── pack-542055b17c2fb18100e23d143d0f824b0c5ee19f.idx
│ └── pack-542055b17c2fb18100e23d143d0f824b0c5ee19f.pack
└── refs
├── heads
│ └── main
└── tags
23 directories, 37 files
test on main [?]
➜ git subtree split -P "gitkraken" --rejoin
cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!
test on main [?]
➜ tree .git
.git
├── COMMIT_EDITMSG
├── FETCH_HEAD
├── HEAD
├── ORIG_HEAD
├── branches
├── config
├── description
├── hooks
│ ├── applypatch-msg.sample
│ ├── commit-msg.sample
│ ├── fsmonitor-watchman.sample
│ ├── post-update.sample
│ ├── pre-applypatch.sample
│ ├── pre-commit.sample
│ ├── pre-merge-commit.sample
│ ├── pre-push.sample
│ ├── pre-rebase.sample
│ ├── pre-receive.sample
│ ├── prepare-commit-msg.sample
│ ├── push-to-checkout.sample
│ └── update.sample
├── index
├── info
│ └── exclude
├── logs
│ ├── HEAD
│ └── refs
│ └── heads
│ └── main
├── objects
│ ├── 0c
│ │ └── ce20ac9c41edfaafd245059b066f4e644b6c84
│ ├── 23
│ │ └── 9ec593c6a2192e76c005435f748b2ad28be832
│ ├── 69
│ │ └── 3d7dd0cbe326ad51fffad7408c2c6cc8af7e0d
│ ├── 74
│ │ └── 11ec84b161eba98f6ae09d2210c231393c977c
│ ├── 84
│ │ └── a5dcf23e618a493da589f95f2c57da22603e2a
│ ├── 99
│ │ └── 03d6d6b962b96143f3e2c0b75550561de14c06
│ ├── b3
│ │ └── 5caa9cbb57f55fb05260b3dd767f92c62a20ba
│ ├── bf
│ │ └── 52649a7b94057b0da0a7f1bb20c55b395717be
│ ├── e4
│ │ └── 22b2b19b0c80773ccbad0822130158a024ef59
│ ├── e6
│ │ └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│ ├── eb
│ │ └── 4c7f2ebf6596f7e3c40b2355bc11e7a1badf58
│ ├── info
│ └── pack
│ ├── pack-542055b17c2fb18100e23d143d0f824b0c5ee19f.idx
│ └── pack-542055b17c2fb18100e23d143d0f824b0c5ee19f.pack
├── refs
│ ├── heads
│ │ └── main
│ └── tags
└── subtree-cache
└── 24098
├── 12d7b0ee9414ebd0414070d22fb40db7446badd9
├── 9903d6d6b962b96143f3e2c0b75550561de14c06
├── e9aad069b8e1e49f8cbb54cb91e3f226e4949712
└── notree
26 directories, 40 files
You need to clear the subtree cache by removing the .git/subtree-cache
folder. You could always try seaching for the 12d7b0ee9414ebd0414070d22fb40db7446badd9
file inside that folder and remove just that.
And then try again again executing your command.
I was able to reproduce and fix that way, the answer was found by reverse engineering the code causing the error: https://github.com/git/git/blob/master/contrib/subtree/git-subtree.sh#L329
I had the same issue and spent many times to solving it.
My co-worker had same problem and after reinstalling git several times, it was solved and I asked him which version he was using.
After downgrading the git version to 2.30.2, 'cache for *** exist' message still appears, but 'subtree push' operation worked successfully
The git version with the problem in my case was 2.35.2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.