[Buildroot] [Bug 14841] New: support/download/git fails with "fatal: No such remote 'origin'" due to incorrect check for origin remote
bugzilla at busybox.net
bugzilla at busybox.net
Fri Jun 10 23:57:55 UTC 2022
https://bugs.busybox.net/show_bug.cgi?id=14841
Bug ID: 14841
Summary: support/download/git fails with "fatal: No such remote
'origin'" due to incorrect check for origin remote
Product: buildroot
Version: 2020.02.10
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Other
Assignee: unassigned at buildroot.uclibc.org
Reporter: bmurdock at gmail.com
CC: buildroot at uclibc.org
Target Milestone: ---
The git script does the following:
- initializes a git repo
- checks if the remote named origin exists
- if it exists, it call git remote set-url to set the correct url for the
origin remote
The problem is, it uses the command 'git remote | grep '^origin$'' to check if
origin exists. This command always prints the word origin, even if the origin
remote doesn't actually exist in the repo. It's unfortunate, but that's how
git works. On a brand new git repo, origin does not exist, but this part of
the script believes it does exist, so it calls git remote set-url which then
fails because origin doesn't exist.
In my project I noticed two packages, flashbench and mmc_utils that use the git
download method and it fails for both of them. The packages still succeed
because they fallback to a different download method. I can imagine that's one
reason why this has not been noticed.
You will also not see this error if the git repo already exists with an actual
origin remote that has been configured.
The proper way to check if origin exists is to do this:
if ! git config remote.origin.url | /dev/null; then...
I have a patch for this and I will work on sending it to the mailing list.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the buildroot
mailing list