Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
805 views
in Technique[技术] by (71.8m points)

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...