本文翻译自:git: fatal: Could not read from remote repository

I am trying to set git up with http://danielmiessler.com/study/git/#website to manage my site. 我正在尝试使用http://danielmiessler.com/study/git/#website设置git来管理我的网站。

I have gotten to the last step in the instructions: git push website +master:refs/heads/master 我已经到达指示的最后一步:git push website + master:refs / heads / master

I am working using the git ming32 command line in win7 我正在使用Win7中的git ming32命令行

$ git push website +master:refs/heads/master
Bill@***.com's password:
Connection closed by 198.91.80.3
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

One problem here may be that the program is looking for Bill@***.com. 这里的一个问题可能是该程序正在寻找Bill@***.com。 when I connect via ssh to my site I have a different username( lets say 'abc'). 当我通过ssh连接到我的网站时,我使用了另一个用户名(可以说'abc')。 so maybe this should be abc@***.com. 所以也许应该是abc@***.com。 If so I don't know how to change this or if I can push under an alias 如果是这样,我不知道该如何更改,或者我是否可以使用别名进行推送


#1楼

参考:https://stackoom.com/question/ugNp/git-致命的-无法从远程存储库读取


#2楼

You can specify the username that SSH should send to the remote system as part of your remote's URL. 您可以指定SSH应该作为远程URL的一部分发送到远程系统的用户名。 Put the username, followed by an @ , before the remote hostname. 在远程主机名前放置用户名,后跟@

git remote set-url website abc@***.com:path/to/repo

#3楼

In your .git/config file 在您的.git / config文件中

[remote "YOUR_APP_NAME"]
    url = git@heroku.com:YOUR_APP_NAME.git
    fetch = +refs/heads/*:refs/remotes/YOUR_APP_NAME/*

And simply 并且简单地

git push YOUR_APP_NAME master:master 

#4楼

After doing some research I've finally got solution for this, you have declared a environment variable to plink.exe path. 经过研究,我终于找到了解决方案,您已将环境变量声明为plink.exe路径。 So if you remove that path, reopen the git bash and try cloning through SSH it will work. 因此,如果删除该路径,请重新打开git bash并尝试通过SSH克隆将起作用。

Refer to this link 参考此链接

http://sourceforge.net/p/forge/site-support/2959/#204c http://sourceforge.net/p/forge/site-support/2959/#204c


#5楼

Make sure you have correct url in .git/config 确保.git/config网址正确

url = git@github.com:username/repo.git

If it's your first push, you'll need to set up correct upstream 如果这是您的第一个建议,则需要设置正确的上游

$ git push -u origin master

You can check which key is used by: 您可以通过以下方式检查使用哪个密钥:

$ ssh -vvv git@github.com

The reply should contain something like this: 答复应包含以下内容:

debug1: Next authentication method: publickey
debug1: Offering RSA public key: ~/.ssh/id_rsa
...
You've successfully authenticated, but GitHub does not provide shell access.

Also it's possible to define rules for ssh in ~/.ssh/config , eg based on aliases: 也可以在~/.ssh/config为ssh定义规则,例如基于别名:

   Host github
      HostName github.com 
      User git
      IdentityFile "~/.ssh/id_rsa"

   Host git
      HostName github.com 
      User git
      IdentityFile "~/.ssh/some_other_id"

You can set connect to different ports, use different username etc. for each alias. 您可以设置连接到不同的端口,为每个别名使用不同的用户名等。


#6楼

Try removing the GIT_SSH environment variable with unset GIT_SSH . 尝试使用未unset GIT_SSH删除GIT_SSH环境变量。 This was the cause of my problem. 这是我问题的原因。

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐