Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-sync-on-inotify fails to get the remote URL #28

Open
emocibob opened this issue Mar 7, 2023 · 2 comments
Open

git-sync-on-inotify fails to get the remote URL #28

emocibob opened this issue Mar 7, 2023 · 2 comments

Comments

@emocibob
Copy link

emocibob commented Mar 7, 2023

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).

@simonthum
Copy link
Owner

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.

@emocibob
Copy link
Author

emocibob commented Apr 5, 2023

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 :)

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

No branches or pull requests

2 participants