我试图设置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。如果是这样,我不知道如何改变这一点,或者如果我可以推下一个别名


当前回答

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

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

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

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

其他回答

我之前也遇到过同样的问题…

我的.git/config有

url = git@github.com:manishnakar/polymer-demo.git

我把它换成了

url = https://github.com/manishnakar/polymer-demo.git 

现在它工作了:)

2020年10月更新

在大多数情况下,当您有多个用户从同一个客户端系统访问同一个git服务器时,该时间git服务器将访问密钥与用户混淆,但当您发出命令时,它将使用默认用户。

ssh -T git@gitlab.com

看看哪些用户是你想要积极推动的用户

简单的解决方案是从git服务器中删除未使用的用户公钥。

然后试着去取或拉,推它会为我工作

如果在“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 

我解决了这个问题,改变我的url从

https://gitlab.com/{gitlab_user}/project_repo.git

to

https://{gitlab_user}@gitlab.com/gitlab_user/project_repo.git

使用命令

git remote set-url https://{gitlab_user}@gitlab.com/gitlab_user/project_repo.git

这通常是由于SSH密钥与远程不匹配造成的。

解决方案:

转到终端,输入以下命令(Mac, Linux)替换为您的电子邮件id。 ssh -t rsa -C "you@email.com" 从word ssh开始,使用以下命令复制生成的密钥。 猫~ / . ssh / id_rsa . pub 粘贴在github, bitbucket或gitlab各自的远程。 保存它。