TortoiseGit 更改默认端口 22 [英] TortoiseGit change default port 22

查看:74
本文介绍了TortoiseGit 更改默认端口 22的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个简单的问题.我在 Windows 8 上运行,我想连接到我公司的存储库.我的公司出于管理原因将默认端口从 22 更改为 1234.

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.

我的 git 存储库看起来像 git@office.comp.com:proj.git.

My git repository looks like git@office.comp.com:proj.git .

首先我不明白':proj.git'中的冒号符号,我习惯了斜杠符号.其次,我想要一种使用 TortoiseGit 或从命令行拉取和推送该端口的方法.我尝试更改 git@office.comp.com:1234:proj.git 和 git@office.comp.com:proj.git:1234 之类的 url,但没有希望.

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 git@office.comp.com:1234:proj.git and git@office.comp.com:proj.git:1234, but no hope.

我总是收到连接超时错误.我在命令行中使用了 ssh -vT -p 1234 git@office.comp.com 并且它能够连接.

I always get a connection timeout error. I used the ssh -vT -p 1234 git@office.comp.com in the command line and it was able to connect.

所以现在我很困惑,我可以使用 ssh 命令进行连接,但我不知道如何在 TortoiseGit 中使用它.

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.

推荐答案

对于不同的端口(和用户名),您可以使用以下 URL 样式 ssh://USERNAME@SERVER:PORT/PATH(例如,ssh://git@office.comp.com:1234/proj.git).

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

对于更细粒度的配置:

PuTTY 具有出色的会话管理功能,您可以在其中保存连接的属性(例如 ssh 密钥、用户名、端口).

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

一个特殊的会话"是默认设置会话,您可以在其中为所有新连接设置默认值(例如密钥、默认用户名、启用压缩、强制 SSH 版本 2 或更改默认端口等).

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

您还可以将(单个)ssh 连接的设置保存为会话.取一台 ssh 服务器仅侦听不同端口的服务器,然后您可以设置所有设置并将其保存到例如服务器名称".现在您可以通过启动 PuTTY 并双击保存的会话列表中的SERVERNAME"来访问此保存的设置,或者,当使用 TortoiseGit、plink 或其他 Putty 应用程序时,将匹配输入的服务器名(例如 git@SERVERNAME:/test.git)保存会话列表,如果找到,则使用保存会话的设置.

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.

会话名称不需要是确切的服务器名称,如果您想使用不同的名称,您也可以使用不同的名称,例如SERVERNAME1"或SERVERNAME-adminkey"(例如 git@SERVERNAME-adminkey:/test.git)在一台服务器上具有相同用户名的密钥.通过这种方式,也可以保存一个名为test.com"的会话,但在访问时会建立到 example.com(保存的主机名)的连接.

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.

来源和更多信息:https://tortoisegit.org/docs/tortoisegit/tgit-ssh-howto.html(复制 1:1 因为我是链接文本的作者)

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)

这篇关于TortoiseGit 更改默认端口 22的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆