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.
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)
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.
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