git-sync-on-inotify fails to get the remote URL
emocibob opened this issue · 2 comments
Hi, thanks for the useful tool!
My issue is that contrib/git-sync-on-inotify
fails to get the remote URL which is used in the following line in the script:
echo "Syncing $(git remote get-url $remote_name) at $(pwd) with a default sync interval of $GIT_SYNC_INTERVAL"
This is the message I see after running git-sync-on-inotify
:
usage: git remote get-url [--push] [--all] <name>
--push query push URLs rather than fetch URLs
--all return all URLs
Syncing at [REDACTED] with a default sync interval of 500
Syncing due to timeout
...
The problem lies with this line:
remote_name=$(git config --get branch.$(basename $(git symbolic-ref -q HEAD)).pushRemote)
basename $(git symbolic-ref -q HEAD)
works fine (returns main
), but git config --get branch.main.pushRemote
doesn't return anything.
This is not a critical issue since the remote URL is just used in an informational message for the user.
My git version: git version 2.37.0 (Apple Git-136)
.
I just confirmed the issue. Do you know an easy fix? I guess
remote_name=$(git config --get branch.$(basename $(git symbolic-ref -q HEAD)).remote)
would work fine.
Hi simonthum,
Sorry for the late reply, remote_name=$(git config --get branch.$(basename $(git symbolic-ref -q HEAD)).remote)
fixes the issue on my end :)