In Git, how can I add a remote origin server when my host uses a different SSH port?
git remote add origin ssh://user@host/srv/git/example
You can do git config --edit to bring up an editor with your settings in it to allow you to change them.
To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at. The git remote add command takes two arguments: A unique remote name, for example, “my_awesome_new_remote_repo” A remote URL, which you can find on the Source sub-tab of your Git repo.
You can just do this:
git remote add origin ssh://user@host:1234/srv/git/example
1234
is the ssh port being used
You need to edit your ~/.ssh/config file. Add something like the following:
Host example.com Port 1234
A quick google search shows a few different resources that explain it in more detail than me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With