I'm using tailscale for a lot of my infrastructure, even to ssh to my nas from any internet connection. This means that tailscale encrypts my traffic and ssh also encrypts the traffic.
This can be fine for a lot of things, but when I'm using git-annex to git annex sync --content it would be nice if I could use the host directly on my network instead of using tailscale's wireguard. I think I can do this by creating two separate special remotes and associating them using sameas. The part I don't fully grasp is how I tell git-annex that it should first prefer the network local host before trying the tailscale global host. Is <remote>.annex-cost enough to do that?
sameasand if cost will work in that case as well.I may have actually come up with a solution. Instead of creating a second remote, I was able to make my
~/.ssh/configdynamic based on the results of adigcommand: https://fmartingr.com/blog/2022/08/12/using-ssh-config-match-to-connect-to-a-host-using-multiple-ip-or-hostnames/Thanks for going with me on this journey!
git-annex allows you to have any number of remotes pointing at the same git repository. It is able to tell it's the same git repository, so you don't need anything like sameas in this case.
All you need is a git remote with an url pointing at the network local host, and set the
<remote>.annex-costof that one lower than the other remote. And git-annex will try it first.Of course a dynamic ssh config is a fine way to do it too..