git - 强制 bitbucket git 命令通过 VirtualBox VM

标签 git ssh bitbucket port portforwarding

我正在尝试找到一种方法来强制 git 命令通过虚拟机。

目前,我有一台没有管理员权限(公司限制)的 Windows 10 计算机,并且上面有 virtualbox,它运行 Linux Mint 作为虚拟机。

当前端口 22 在我们的网络上被阻止,Windows 无法通过 SSH 执行 git 命令。我什至尝试使用 SSH 配置文件将 SSH 转发为使用端口 443 而不是 22,但他们也阻止了这一点。

有趣的是,当我在虚拟机上执行 git 命令时,它运行良好,并且看起来好像没有被阻止。

我想要实现的是以某种方式使我在 Windows (Git Bash) 中执行的所有 git 命令通过 VM,然后通过 VM 到 Bitbucket。

我希望这是有道理的。因此,我想将所有流量从 Windows 转发到 Bitbucket,然后转到 Linux Mint VM,该 VM 位于同一设备上的 VirtualBox 上并具有静态内部 IP,然后 VM 会将其转发到它应该去的地方,即 Bitbucket。

想象一下执行以下 git 命令: git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="caada3be8aa8a3bea8bfa9a1afbee4a5b8ad" rel="noreferrer noopener nofollow">[email protected]</a>:xxxx/yyyy.git

有人知道如何实现这一目标吗?

先谢谢你们了。

最佳答案

What I am trying to achieve is to somehow make all the git commands that I do in Windows (Git Bash) to go through VM and then VM to Bitbucket.

这正是我工作过的每家大公司都不允许 Windows PC 上的 VM 的原因:您可以绕过 IT 施加的限制。

我从未见过端口 22 允许传出请求。我始终使用 HTTPS 进行外部 Git 存储库操作。

您也许可以通过 forced command (like gitolite does) 配置您的 SSH为了运行一个脚本,该脚本将:

  • 拦截你的 git 命令
  • 更新共享文件夹(在虚拟机和主机之间共享)中匹配的位桶

但首先请确保您没有规避 IT 安全策略,否则迟早会遇到这种情况。

关于git - 强制 bitbucket git 命令通过 VirtualBox VM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66434815/

相关文章:

git - 为 ec2 设置 git 部署过程

git - 使用 GitHub 进行 Mac OS 命令行身份验证

ruby-on-rails - 如何将更改从 Bitbucket 推送到 Heroku

git - Jenkins Git fatal error : unable to access 'https//URL.git' : SSL certificate p‌r‌o‌b‌l‌e‌m: self signed certificate

git - 删除提交git

Github - 如何在我的个人资料中显示协作项目?

git - SourceTree 终端自动加载 ssh key

git - Jupyter 笔记本 + bitbucket 中的 pull 请求

git - Emacs + GPG + pinentry.el 进行身份验证

git - 为什么 visual studio 在我的 .gitignore 文件中提交文件?