Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TortoiseGit change default port 22

It's probably an easy question. I'm running on windows 8, and I want to connect to my company's repository. My company changed the default port from 22 to 1234 for some administrative reason.

My git repository looks like [email protected]:proj.git .

First of all I don't understand the colon-notation in ':proj.git', I'm used to the slash-notation. Secondly I want a way to pull and push on that port either using TortoiseGit or from the command line. I tried changing the url like [email protected]:1234:proj.git and [email protected]:proj.git:1234, but no hope.

I always get a connection timeout error. I used the ssh -vT -p 1234 [email protected] in the command line and it was able to connect.

So now I'm confused, I was able to connect using the ssh command but I don't know how to use it inside TortoiseGit.

like image 593
Poka Yoke Avatar asked Jan 09 '23 18:01

Poka Yoke


2 Answers

For just a different port (and username) you can use the following URL style ssh://USERNAME@SERVER:PORT/PATH (e.g., ssh://[email protected]:1234/proj.git).


For more fine grained configuration:

PuTTY comes with a great session management, where you can save attributes of connections (e.g. ssh key, username, port).

One special "session" is the Default Settings session, where you can set default values for all new connections (e.g. a key, a default username, enable compression, force SSH version 2 or change the default port and so on).

You can also save settings for (single) ssh connections as sessions. Take one server where the ssh server only listens on a different port, then you can set up all settings and save it to e.g. "SERVERNAME". Now you can access this saved settings by starting PuTTY and double clicking "SERVERNAME" in the saved sessions list OR, when using TortoiseGit, plink or other putty applications, the entered servername (e.g. git@SERVERNAME:/test.git) will be matched against the saved sessions list and if found, the settings of the saved session are used.

Session names do not need to be the exact servername, you can also use different names, like "SERVERNAME1" or "SERVERNAME-adminkey" (e.g. git@SERVERNAME-adminkey:/test.git) if you want to use different keys with the same username on one server. This way it is also possible to have a saved session called "test.com", but when accessed a connection to example.com (saved hostname) is established.

Source and further information: https://tortoisegit.org/docs/tortoisegit/tgit-ssh-howto.html (copied 1:1 because I'm the author of the linked text)

like image 81
MrTux Avatar answered Jan 16 '23 18:01

MrTux


a simpler alternative is to use the following url format:

ssh://[email protected]:1234/proj.git

you can use this format to clone directly from the repo without configuring the sessions in putty before.

enter image description here

like image 45
c33s Avatar answered Jan 16 '23 18:01

c33s