Me gustaría forzar todos los clones / pull para get los datos de SSH, pero continuar usando HTTPS para push.
Mi command siempre usará https ( git clone https://
) y no puedo cambiar esto (muchos scritps usando) pero me gustaría obligar al clon a usar SSH, y continuar usando HTTPS para push.
Lo que hice (en este order):
[url "ssh://server/"] insteadOf = "https://server/" [url "https://server/"] pushInsteadOf = "ssh://server/"
Pero tanto fetch como push están siendo traducidos a SSH:
$ git remote -v origin ssh://server/repo.git (fetch) origin ssh://server/repo.git (push)
Y me gustaría ver algo como esto:
$ git clone https://server/repo.git $ git remote -v origin ssh://server/repo.git (fetch) origin https://server/repo.git (push)
Por extraño que parezca, tendrás que traducir https a https para que funcione;
[url "ssh://server/"] insteadOf = "https://server/" [url "https://server/"] pushInsteadOf = "https://server/"
Usa git remote set-url --push
. De la documentation:
set-url Changes URL remote points to. Sets first URL remote points to matching regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If <oldurl> doesn't match any URL, error occurs and nothing is changed. With --push, push URLs are manipulated instead of fetch URLs. With --add, instead of changing some URL, new URL is added. With --delete, instead of changing some URL, all URLs matching regex <url> are deleted. Trying to delete all non-push URLs is an error.