我试图设置git与http://danielmiessler.com/study/git/#website来管理我的网站。

我已经到了指令的最后一步:git push website +master:refs/heads/master

我正在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.

这里的一个问题可能是程序正在寻找bill@* **.com。当我通过ssh连接到我的网站,我有一个不同的用户名(让我们说'abc')。也许这个应该是abc@***。com。如果是这样,我不知道如何改变这一点,或者如果我可以推下一个别名


当前回答

我通过重新启动终端解决了这个问题(打开一个新的窗口/选项卡)。

所以如果你真的不想/不需要理解潜在的问题,在深入挖掘之前,测试方法值得一试:)

其他回答

如果在“git push origin master”命令后,你看到错误“could not read from remote repository”,然后试试这个

1.ssh-keygen -t rsa -b 4096 -C "youremail"
2.eval $(ssh-agent -s)
3.ssh-add ~/.ssh/id_rsa
4.clip < ~/.ssh/id_rsa.pub(it copies the ssh key that has got generated)
5.then go to your remote repository on github and goto settings-> SSH and GPG keys ->new SSH key ->enter any title and paste the copied SSH key and save it
6. now give git push origin master 

实际上,我尝试了很多方法让它在Win7上工作,因为将SSH exectun从本机更改为build-it和向后更改,同样的错误。 偶然,我在“。”中将其更改为HTTPS。Git /config"文件如下:

[remote "origin"]
        url = https://github.com/user_name/repository_name.git
        fetch = +refs/heads/*:refs/remotes/origin/*

最终成功了。所以也许对你也有用。

我换了电脑后出现了这个错误。我使用SourceTree和Bitbucket。

所以我必须在新电脑上添加SourceTree生成的SSH密钥,在比特桶设置>安全> SSH密钥,同时连接到我的网络比特桶帐户。

添加到“我有同样的问题和……”,我也在Windows中通过Ming32 (git bash) shell使用git。

在我的情况下,回购要求我输入密码,不使用SSH密钥,但它没有提示密码,只是说“致命:无法读取…”,尽管我可以SSH正常,使用plink和SSH,并设置了两个已知的主机密钥。

我尝试了这里和其他SOs的大部分建议。

最后我发现它在Powershell中工作得很好,但在git bash中不行,没有任何更改或更正。

我尝试了所有的方法,包括生成新的密钥,添加到GitHub帐户,编辑.ssh/config和.git/config。但它还是给出了同样的错误。 然后我尝试了命令,它确实工作成功。

ssh-agent bash -c 'ssh-add ~/.ssh/id_rsa; git clone git@github.com:username/repo.git'