如何检查存储库是否通过 HTTP 或 ssh 克隆?
How to check if a repository is cloned via HTTP or ssh?
我需要一种快速的方法来了解我所在的存储库是通过 HTTP 还是 ssh 克隆的?正在寻找来自 Git 或任何其他配置检查点的命令来为我提供此信息。
此命令将向您显示 the URLs 回购将按 默认值1:
git remote show origin
In general, URLs contain information about the transport protocol, the address of the remote server, and the path to the repository. Depending on the transport protocol, some of this information may be absent.
Git supports ssh, git, http, and https protocols (in addition, ftp, and ftps can be used for fetching, but this is inefficient and deprecated; do not use it).
虽然不能保证它就是最初克隆存储库的地方(因为您可以使用 --set-url
option of git remote
轻松更改与远程关联的 URL),但它是在大多数情况下是非常安全的选择。
- 在“默认”情况下,我的意思是如果您只执行
git fetch
或 git push
而不指定远程名称。
我需要一种快速的方法来了解我所在的存储库是通过 HTTP 还是 ssh 克隆的?正在寻找来自 Git 或任何其他配置检查点的命令来为我提供此信息。
此命令将向您显示 the URLs 回购将按 默认值1:
git remote show origin
In general, URLs contain information about the transport protocol, the address of the remote server, and the path to the repository. Depending on the transport protocol, some of this information may be absent.
Git supports ssh, git, http, and https protocols (in addition, ftp, and ftps can be used for fetching, but this is inefficient and deprecated; do not use it).
虽然不能保证它就是最初克隆存储库的地方(因为您可以使用 --set-url
option of git remote
轻松更改与远程关联的 URL),但它是在大多数情况下是非常安全的选择。
- 在“默认”情况下,我的意思是如果您只执行
git fetch
或git push
而不指定远程名称。