Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.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:VS代码中的克隆返回“;权限被拒绝,请重试";-终端工程中的git克隆_Git_Macos_Visual Studio Code - Fatal编程技术网

Git:VS代码中的克隆返回“;权限被拒绝,请重试";-终端工程中的git克隆

Git:VS代码中的克隆返回“;权限被拒绝,请重试";-终端工程中的git克隆,git,macos,visual-studio-code,Git,Macos,Visual Studio Code,Git:Clone在Visual Studio中mac上的代码返回权限被拒绝,请重试。从VisualStudio代码中的终端执行git克隆 在Mac上的Visual Studio代码中,我执行以下操作: 我做Git:Clone 我输入以下格式的ssh存储库URL:ssh://@/.git I“选择存储库位置”文件夹,并获得以下对话框: 此函数从不要求我输入任何密码 如果我打开Git日志,输出如下: > git clone <ssh-repository-URL> <pa

Git:Clone
在Visual Studio中mac上的代码返回
权限被拒绝,请重试
。从VisualStudio代码中的终端执行git克隆

在Mac上的Visual Studio代码中,我执行以下操作:

  • 我做
    Git:Clone
  • 我输入以下格式的ssh存储库URL:
    ssh://@/.git

  • I“选择存储库位置”文件夹,并获得以下对话框:

  • 此函数从不要求我输入任何密码

    如果我打开Git日志,输出如下:

    > git clone <ssh-repository-URL> <path>
    Cloning into '<path>'...
    Permission denied, please try again.
    Permission denied, please try again.
    Received disconnect from <IP> port 22:2: Too many authentication failures for <username>
    Disconnected from <IP> port 22
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    
    >git克隆
    正在克隆到“”。。。
    权限被拒绝,请重试。
    权限被拒绝,请重试。
    接收到来自端口22:2的断开连接:的身份验证失败太多
    从端口22断开
    致命:无法从远程存储库读取。
    请确保您拥有正确的访问权限
    并且存储库存在。
    
    在终端中,它工作:

    mac:rep username$ git clone 
    Cloning into '<repository>'… <ssh-repository-URL>
    The authenticity of host ‘<repository-host> (<repository-ip>)' can't be established.
    ECDSA key fingerprint is SHA256:<fingerprint>.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '<repository-host>,<repository-ip>' (ECDSA) to the list of known hosts.
    Password:
    remote: ...
    remote: ...
    remote: …
    Receiving objects: 100% (.../...), ... | ... MiB/s, done.
    Resolving deltas: 100% (.../...), done.
    
    mac:rep username$git clone
    正在克隆到“”…
    无法建立主机“()”的真实性。
    ECDSA密钥指纹是SHA256:。
    是否确实要继续连接(是/否)?对
    警告:已将“,”(ECDSA)永久添加到已知主机的列表中。
    密码:
    远程:。。。
    远程:。。。
    远程:…
    接收对象:100%(…/…),…|。。。MiB/s,完成。
    解析增量:100%(…/…),完成。
    

    关于为什么
    Git:Clone
    Visual Studio code从不请求服务器密码的任何线索?

    在设置存储库URL并选择目标文件夹后,
    Git:Clone
    中的底层功能似乎与用户没有任何交互

    要使ssh存储库使用Visual Studio代码,您需要执行以下操作:

  • 开放式终端
  • 运行
    ssh-keygen
    生成ssh密钥对
  • 运行
    ssh copy id-i~/.ssh/id\u rsa@
  • 从这个和这个衍生出来

    关于版本控制的VS代码用户指南在常见问题下有以下问题/答案:


    是的,不过VS代码最容易使用没有密码的SSH密钥。如果您有一个带有密码短语的SSH密钥,那么您需要从Git Bash提示符启动VS代码来继承其SSH环境。

    从上面提到的内容来看,我认为VS代码拒绝远程,因为终端部分提到的真实性问题。您能否尝试使用
    https
    而不是
    ssh
    克隆回购协议?@dstrants谢谢。我将更新这个问题,因为Git:Clone从不要求提供存储库服务器的密码。在终端我可以输入密码。关于https,我认为我们的本地存储库服务器不支持它。您是否向ssh密钥添加了密码?@evolutionxbox非常感谢!这个问题实际上让我找到了解决问题的方法,因为我不知道只有在正确设置ssh密钥时才能在Git:Clone中使用ssh URL。您可以添加您的解决方案作为答案吗?我花了3个小时才发现,在vs代码Git克隆中,密码短语的使用不是直接的。