Skip to content

Conversation

makenowjust
Copy link
Contributor

git fetch master:master means synchronization of the remote master with the local master. If the local master is HEAD, Git will also try to update the file tree, but it is refused by default. Thus, we may see the errors like fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository.

One of solutions is using --update-head-ok (-u) flag. It enforces to update the file tree on fetching HEAD. However, it seems not good to me because the Rake task uses git checkout after this git fetch so the file system updation on fetch is unnecessary.

Another solution, by using this, is correcting refspec so that destination part becomes origin. Presumably, this is the canonical fix method.

I'm not sure why the CI have been passed. Maybe GitHub returns a different (optimized) response on CI.

`git fetch master:master` means synchronization of the remote `master` with
the local `master`. If the local `master` is `HEAD`, Git will also try to
update the file tree, but it is refused by default. Thus, we may see the
errors like `fatal: Refusing to fetch into current branch refs/heads/master
of non-bare repository`.

One of solutions is using `--update-head-ok` (`-u`) flag. It enforces to
update the file tree on fetching `HEAD`. However, it seems not good to
me because the Rake task uses `git checkout` after this `git fetch` so
the file system updation on fetch is unnecessary.

Another solution, by using this, is correcting refspec so that destination
part becomes `origin`. Presumably, this is the canonical fix method.

I'm not sure why the CI have been passed. Maybe GitHub returns a different (optimized) response on CI.
@kateinoigakukun kateinoigakukun merged commit fc64e70 into ruby:main Mar 6, 2023
@makenowjust makenowjust deleted the refspec branch March 6, 2023 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants