我试图设置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,突然我得到了一个错误,当我试图推到master。我发现,这是因为存储库主机有问题。

如果你使用GitHub或Bitbucket,你可以很容易地检查状态

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

其他回答

我解决了这个问题,改变我的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应该发送到远程系统的用户名作为远程URL的一部分。在远程主机名之前输入用户名,后面加@。

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

我也有同样的问题。

此错误意味着您没有指定代码将在其上进行推送的远程URL位置。

远程URL设置主要有2种方式:

通过在Git Bash上执行命令指定远程URL。 导航到项目目录 打开Git Bash 执行命令: git remote set-url origin <https://abc.xyz/USERNAME/REPOSITORY.git> 在配置文件中直接提到远程URL 导航到项目目录 移动到。git文件夹 在文本编辑器中打开配置文件 复制并粘贴以下行 (远程“起源”) url = https://abc.xyz/USERNAME/REPOSITORY.git Fetch = +refs/heads/*:refs/remotes/origin/*

欲了解更多详细信息,请访问此链接。

有时你需要使用ssh:// scheme的完整URL:

ssh://git@yourhost:port/path/repo.git

或指定端口:

ssh://git@yourhost:port/path/repo.git

对我来说,这解决了问题。

在我的情况下,我试图克隆与sudo。根据Github的文档,你不应该使用sudo与git克隆: https://help.github.com/en/github/authenticating-to-github/error-permission-denied-publickey#should-the-sudo-command-be-used-with-git

我所做的是给当前用户编辑目录的权限(Debian 9):

chown myuser:root .

然后克隆没有sudo,它工作。