我一直在寻找一个关于如何使用多个ssh密钥的解决方案,我发现它可以在.ssh目录中使用配置文件,但它不适用于Windows.
我的问题是,我使用的是私有密钥来访问git的服务器,所以它看起来是这样的:SSH://git@example.com/directory,它工作正常,当我使用TortoiseGit,"原因是有选择私钥的可能性.
但是我想在我的IntelliJ IDEA中使用git rep,只有使用git native shell的选项,如果我将名为id_rsa的密钥放入.ssh文件夹,它也可以工作.现在我想使用多个ssh密钥(因此我的密钥将获得名称"id_rsa_test",因此如何在Windows下配置.ssh/config文件,它是否适用于通常的git服务器?
我发现的大多数例子都只是用于github.
我想更新git clone上的子模块.
有没有办法用Jenkins管道Git命令做到这一点?
目前我正在这样做......
git branch: 'master',
credentialsId: 'bitbucket',
url: 'ssh://bitbucket.org/hello.git'
Run Code Online (Sandbox Code Playgroud)
但是,一旦克隆,它就不会更新子模块
我想为 git 使用其他 IdentityFile。我想动态使用它,而不是通过配置。我这样做:
$ GIT_SSH_COMMAND='ssh -i /home/my_user/.ssh/id_ed25519' git pull origin master
repository access denied.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
pub 密钥“id_ed25519.pub”在我的 bitbucket 中。
这也失败了:
$ git pull origin master
repository access denied.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
和:
$ git remote -v
origin git@bitbucket.org:company123/repo456.git (fetch)
origin git@bitbucket.org:company123/repo456.git (push)
Run Code Online (Sandbox Code Playgroud)
将 …
我想弄清楚在 Windows 上运行 git bash 时 git 命令使用哪个 SSH 客户端。我可以运行任何 git 命令来显示 ssh 客户端路径吗?
我有一个在我的詹金斯管道上运行的bat脚本。
它用于标记我的分支的特定提交,并将其推送回 git。看起来像这样:
"scriptCommand": https://%C_USERNAME%:%C_PASSWORD%@bitbucket.psr.io/scme/ci/ci.git\ngit push origin TAG1\ngit remote set-url --push origin https://bitbucket..psr.io/scme/ci/ci.git"
Run Code Online (Sandbox Code Playgroud)
该命令是使用变量 C_USERNAME、C_PASSWORD 和 TAG1 进行的。前两个取自 usernamePassword 类型的 jenkins 凭证,并注入到字符串中,TAG1 是一个 simple 字符串,应该用于标记我的 git 分支
当我为我的存储库使用 http 链接而不是 SSH 链接时,这是有效的
我还需要能够处理 SSH 链接。为此,我研究了 SSH 私钥,结果发现 jenkins 凭证有一个特定的字段:带有私钥的 SSH 用户名
我使用我的私钥和用户名在詹金斯中创建了一个这样的凭证
但现在我在如何创建一个与上面带有 http 链接的批处理行相同的批处理行时遇到了麻烦。
不用说,我在这件事上的经验是0。
有人可以帮我解决这个问题吗?感谢您抽出时间。
互联网上有大量相同的解决方案,用于定义 git 下载的代理隧道,就像这样,这一切都是通过设置 git 的https.proxy& http.proxyconfig.js 来实现的。但是当您尝试通过协议clone/ push/pull等时,这些答案不起作用ssh!
例如,通过设置git config --global https.proxy socks5://127.0.0.1:9999当您尝试克隆时git clone git@github.org:user/repo.git它不通过定义的 sock5 隧道!
我尝试了各种方法,但都没有奏效!
如何设置 git127.0.0.1:9999在使用ssh连接时使用本地 socks5 代理(例如)?
我必须键入 ~/.ssh 目录。当我尝试在控制台中提交某些内容时,bitbucket 要求我输入密码而不是使用 ssh 密钥。此外,当我尝试克隆这个 repo 以使用全局 git 设置时,它仍然要求我输入密码。
我的问题: