While we don't really support this natively, tangled repo's hosting knot can change, just like atproto PDS can change. And I think it's better to make this seemless to users.
Hiding from fetch url #
git-http #
For git-http, it's pretty easy. We already support this by redirecting https://tangled.org/<owner>/<repo> to https://<target-knot>/<owner>/<repo>. Because it's redirect, they should still need to configure credential helper for individual knots, but for read-operations, everything just works.
git-ssh #
We can do same thing for git-ssh. git@tangled.org:<owner>/<repo> will forward the request to git@<target-knot>:<owner>/<repo>. This is also pretty easy because read operations can be done anonymously. We aren't trying to establish ssh connection between user and knot, but rather tangled.org and knot.
> remote: Thanks for using knot.example.com!
> remote:
> remote: Reading owner.com/reponame anonymously through tangled.org.
> remote: To push straight to its knot, run this inside the repository:
> remote:
> remote: git config url.boltless.me@knot.example.com:owner.com/reponame.pushInsteadOf boltless.me@tangled.org:owner.com/reponame
> remote:
> remote: Enumerating objects: 7494, done.
> remote: Total 7494, done.
We would probably want to show this message only when user tried git-push against git@tangled.org, not on every ssh connections.
Hiding from push url #
git-http #
Hiding knot from push url becomes bit interesting. For git-http, we can make tangled.org proxy the request to knot instead of redirecting. So users will only need one tangled-scoped config instead of per-knot config:
[credential "https://tangled.org"]
helper =
helper = !tngl git credential
instead of:
[credential "https://knot1.tangled.sh"]
helper =
helper = !tngl git credential
[credential "https://knot.us-east.tangled.network"]
helper =
helper = !tngl git credential
[credential "https://knot.oyster.cafe"]
helper =
helper = !tngl git credential
# ...
We should be more careful if we do proxying over redirects but I think it's worth doing.
git-ssh #
I think it's not impossible to completely hide the knot hostname from push url. Users need to config credential helper for http-push anyway, then why not have ssh-helper that does knot resolving before ssh connection by wrapping the core.sshCommand?
[core]
sshCommand = tngl git ssh --
Of course this will be recommended opt-in feature and we should have clear documentations about why and what is happening.
So if we do all of above, only config users will need in their config are:
# for git-push over ssh
[core]
sshCommand = tngl git ssh --
# for git-push over http
[credential "https://tangled.org"]
helper =
helper = !tngl git credential
We should probably support
tangled://user.tngl.sh/repo-namecase too. This won't need known tangled appview proxying the request.