“拒绝访问”当通过SSH推送到远程存储库时 [英] "Access denied" when pushing to remote repository via SSH

查看:1055
本文介绍了“拒绝访问”当通过SSH推送到远程存储库时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Git的新手,并且似乎在通过网络推送到存储库时遇到了问题。

这是我重新创建问题的方式:


  1. 在计算机上创建一个新的Git存储库,以推送至

      mkdir〜/ git / test.git 
    cd!$
    git --bare init


  2. 然后在我的本地计算机上创建一个新的Git存储库,并为其添加一个随机文件:

      mkdir test 
    git init
    touch TEST
    git add。
    git commit -minitial commit


  3. 然后通过远程计算机: git remote add origin ssh://user@site.com/~/git/test.git


  4. 然后我尝试通过以下方式将本地存储库推送到远程: git push origin master



 致命:协议错误:坏行长度字符<  - 有时候不存在
访问被拒绝
访问被拒绝
访问被拒绝
访问被拒绝
致命错误:服务器发送断开消息
类型2(协议错误):
用户验证失败太多

我在XP机器上使用cygwin并试图推到一个unix服务器。

我也在我家里的两台电脑之间尝试过它,并且我遇到了同样的问题,都是顺便说一下windows机器。 / p>

我通过SSH设置了无密码登录,我可以 ssh 没有问题通过: ssh user@site.com



我一直试图弄清楚这两天现在,任何帮助将不胜感激

解决方案

这个问题可能是〜在ssh URI中使用时不会正确扩展。您需要在ssh URI中指定远程计算机上git存储库的绝对路径,如下所示:

 ssh:// user @ site。 com / home / user / git / test.git 


I am a newbie with Git and seem to have a problem with pushing to a repository over a network.
Here is what I do to recreate the problem:

  1. create a new Git repository on the computer to push to

    mkdir ~/git/test.git
    cd !$
    git --bare init
    

  2. On my local computer I then create a new Git repository and add a random file to it:

    mkdir test
    git init
    touch TEST
    git add .
    git commit -m "initial commit"
    

  3. Then add the remote computer via: git remote add origin ssh://user@site.com/~/git/test.git

  4. Then I try to push the local repository to the remote via: git push origin master

This is what I get when I do that:

fatal: protocol error: bad line length character  <- sometimes not there
Access denied
Access denied
Access denied
Access denied
FATAL ERROR: Server sent disconnect message
type 2 (protocol error):
"Too many authentication failures for user"

I am using cygwin on an XP machine and trying to push to a unix server.

I have also tried it between my two computers I have at home and I have the same problem, both are windows machines by the way.

I have set up passwordless login via SSH and I can ssh no problem via: ssh user@site.com

I've been trying to figure this out for two days now, any help would be appreciated

解决方案

The issue is probably that ~ won't expand correctly when using it in a ssh URI. You would need to specify the absolute path to the git repository on the remote machine in the ssh URI, like this:

ssh://user@site.com/home/user/git/test.git

这篇关于“拒绝访问”当通过SSH推送到远程存储库时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆