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:34

I had the same error. The solution was following: I've corrected my url in .git/config. Just copied that from HTTPS clone URL. That would be something like that:

url = https://github.com/*your*git*name*/*your*git*app*.git

It worked.

查看更多
谁念西风独自凉
3楼-- · 2019-01-01 17:34

According to my experience, one of the reasons this problem occured is because you have an unstable internet connection.

查看更多
回忆,回不去的记忆
4楼-- · 2019-01-01 17:36

Try removing the GIT_SSH environment variable with unset GIT_SSH. This was the cause of my problem.

查看更多
临风纵饮
5楼-- · 2019-01-01 17:36

I had the same problem.

This error means that you have not specified your remote URL location upon which your code will push.

You can set remote URL by 2 (mainly) ways:

  1. Specify remote URL via executing command on Git Bash.

    • Navigate to your project directory

    • Open Git Bash

    • Execute command:

      • git remote set-url origin <https://abc.xyz/USERNAME/REPOSITORY.git>
  2. Mention remote URL direct in config file

    • Navigate to your project directory

    • Move to .git folder

    • Open config file in text editor

    • Copy and paste below lines

      • [remote "origin"] url = https://abc.xyz/USERNAME/REPOSITORY.git fetch = +refs/heads/*:refs/remotes/origin/*

For more detailed info visit this link.

查看更多
谁念西风独自凉
6楼-- · 2019-01-01 17:37

After doing some research I've finally got solution for this, you have declared a environment variable to plink.exe path. So if you remove that path, reopen the git bash and try cloning through SSH it will work.

Refer to this link

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

查看更多
人间绝色
7楼-- · 2019-01-01 17:37
登录 后发表回答