git: fatal: Could not read from remote repository

2019-01-01 17:01发布

I am trying to set git up with http://danielmiessler.com/study/git/#website to manage my site.

I have gotten to the last step in the instructions: git push website +master:refs/heads/master

I am working using the git ming32 command line in win7

$ 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. when I connect via ssh to my site I have a different username( lets say 'abc'). so maybe this should be abc@***.com. If so I don't know how to change this or if I can push under an alias

标签: git
30条回答
裙下三千臣
2楼-- · 2019-01-01 17:18

i just wanted to share that i found a easy fix for that:

Access denied. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

just logout from gitlab and login again. The problems should then be fixed.

查看更多
爱死公子算了
3楼-- · 2019-01-01 17:19

You can specify the username that SSH should send to the remote system as part of your remote's URL. Put the username, followed by an @, before the remote hostname.

git remote set-url website abc@***.com:path/to/repo
查看更多
初与友歌
4楼-- · 2019-01-01 17:21

This is usually caused due to the SSH key is not matching with the remote.

Solutions:

  1. Go to terminal and type the following command (Mac, Linux) replace with your email id.

    ssh-keygen -t rsa -C "you@email.com"

  2. Copy the generated key using following command starting from word ssh.

    cat ~/.ssh/id_rsa.pub

  3. Paste it in github, bitbucket or gitlab respective of your remote.
  4. Save it.
查看更多
看风景的人
5楼-- · 2019-01-01 17:21

I had a perfectly fine working git and suddenly I got that error when I tried to push to the master. As I found out, it was because the repository host had problems.

If you using GitHub or Bitbucket you can easily check the status at

https://status.github.com/messages or https://status.bitbucket.org/

enter image description here

查看更多
弹指情弦暗扣
6楼-- · 2019-01-01 17:22

I just wanted to add to this question. I had Git setup to use PLink and Pageant for authentication and I was also getting the error FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey). I had Pageant opened but the error was still showing up. The problem? I didn't have the private key loaded in Pageant (to add a key, follow these instructions). It was that simple.

查看更多
泛滥B
7楼-- · 2019-01-01 17:23

In my case I was using an ssh key with a password to authenticate with github. I hadn't set up pageant properly in Windows (only in cygwin). The missing steps were to point the git_ssh environment variable to plink.exe. Also, you need to get github.com into the plink known_hosts.

   plink github.com
   y
   <then ctrl-c>

Hope this helps!

I sure wish intellij would have given me a more useful error, or better yet asked me to type in the ssh key password.

查看更多
登录 后发表回答