Handle different push and fetch remotes

My repo can be fetched from `https://git.sprovoost.nl/instablossom.git/` by anyone. To push I use a git:// remote which goes over SSH.

But in order to use git-remote-nostr I had to replace both remotes with:

```

origin nostr://npub1s6z7hmmx2vud66f3utxd70qem8cwtggx0jgc7gh8pqwz2k8cltuqrdwk4c/instablossom

```

This causes a problem, because git push will now update the repo on Nostr but then it fails trying to push to the https origin. I can work around this by adding a second origin and manually pushing there.

I ideally I should be able to configure the push origin that git-remote-nostr uses under the hood. That URL should not be published (it's unreachable).

Reply to this note

Please Login to reply.

Discussion

Sorry I was a bit sloppy in my description. The actual remote is user@machine:/src/git/instablossom.git, not using git://

It uses SSH.

The clone URL is unauthenticated https. However when you try to push to that URL it won't fail immediately, it will try to authenticate. I then abort that, which probable ends the script.

Ah I guess the trick is to hit enter when it prompts for my password. That fails authentication, without aborting the script.

Update: the trick didn't work, I still had to manually push to the "real" origin. Though there was no error message.

We definitely need to be able to specify the server protocol. If ssh is used initially it appears to fallback to https but if https is used, it will keep trying to authenticate you with a username and password.

I switched over to a self-hosted Forgejo, and only using https for now. It would still be nicer to be able to push via ssh, but no rush.

this should be fixed in ngit v1.5. can you confirm?

From the change log:

- intelligent protocol selection and fallback

- unless unusual protocol specified in repo event clone url it

will try in this order:

- fetch: https unatuth, ssh, https

- push: ssh, https auth

- save successful protocol in git config so it is tried first

next time

- enable override from nostr url (will only use this protocol)