Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git remote add with other SSH port

Tags:

git

port

ssh

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 
like image 701
JuanPablo Avatar asked Aug 29 '10 19:08

JuanPablo


People also ask

How do I change my git port?

You can do git config --edit to bring up an editor with your settings in it to allow you to change them.

How do I add a second remote to git?

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.


2 Answers

You can just do this:

git remote add origin ssh://user@host:1234/srv/git/example 

1234 is the ssh port being used

like image 70
igorw Avatar answered Sep 23 '22 04:09

igorw


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.

like image 42
bramp Avatar answered Sep 21 '22 04:09

bramp