Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git(bitbucket):通过ssh隧道进入现有存储库_Git_Ssh_Bitbucket - Fatal编程技术网

Git(bitbucket):通过ssh隧道进入现有存储库

Git(bitbucket):通过ssh隧道进入现有存储库,git,ssh,bitbucket,Git,Ssh,Bitbucket,显然,从我目前所在的伊朗访问bitbucket存在一些问题。这涉及git工作流及其网站。这不是审查,因为审查将页面输出替换为“真正的审查”。在这里,当我尝试拉车时,我只是得到超时和以下信息: ssh: connect to host bitbucket.org port 22: Operation timed out fatal: Could not read from remote repository. Please make sure you have the correct acces

显然,从我目前所在的伊朗访问bitbucket存在一些问题。这涉及git工作流及其网站。这不是审查,因为审查将页面输出替换为“真正的审查”。在这里,当我尝试拉车时,我只是得到超时和以下信息:

ssh: connect to host bitbucket.org port 22: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
我在欧洲有另一台电脑,我可以ping和ssh,所以我想通过这台电脑。我使用Mac OS。我尝试了以下方法:

  • 打开一个终端窗口,然后

    ssh -L 3333:bitbucket.org:22 user@ssh-host -N
    
  • 打开另一个终端窗口,进入
    .git/config
    并替换

    url = git@localhost:3333/project.git
    
然而,我明白了

ssh: connect to host localhost port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
由于我是真正糟糕的互联网的幕后黑手,所以重要的是不要从零开始克隆项目,而要使用我已经在本地拥有的存储库进行更新

如果这是一个调试命令,下面是评论员命令的输出:

$ ssh -vvv git@bitbucket.org
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to bitbucket.org [104.192.143.2] port 22.
debug1: connect to address 104.192.143.2 port 22: Operation timed out

您可以尝试将以下内容添加到~/.ssh/config中

Host bitbucket
HostName bitbucket.org
ProxyCommand ssh user@ssh-host nc %h %p
然后仅从本地主机使用以下命令:


git@bitbucket/project.git

ssh-vvv-bitbucket.org
或者更确切地说
ssh-vvvgit@bitbucket.org
@Jakuje抱歉,我不明白我该怎么处理它。这是一个调试命令,还是应该将其放入.git/config中?ssh隧道只是将localhost:3333端口隧道到ssh主机:22端口,而不是bitbucket.org。由于您在欧洲的服务器上没有存储库,因此无法从中进行克隆。您可以首先在服务器上镜像bitbucket repo,然后克隆它。您可以使用HTTPS吗?这可能会使与bitbucket的通信更容易。要使隧道工作,您需要将中间服务器的端口3333映射到bitbucket.org:22(即,在您的欧洲服务器上打开隧道),然后您需要连接到端口3333上的服务器,而不是本地主机(本地主机将始终映射到您自己的计算机)。因此URL应该类似于
git@european-服务器:3333/project.git
。这给我留下了致命的:
'git@bitbucket/project.git'似乎不是git存储库致命:无法从远程存储库读取。