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


当前回答

我也有同样的问题。

此错误意味着您没有指定代码将在其上进行推送的远程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/*

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

其他回答

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

我也犯了同样的错误,这让我得到了这个没有帮助的答案。 我试图创建一个新的“裸”存储库,第一次使用以下命令跟踪到NTFS位置:

cd myrepository
git init --bare \\myserver.mycompany.local\myrepository.git
git init
git status
git add .
git status
git commit -m "Initial Commit"
git remote add origin \\myserver.mycompany.local\myrepository.git
git push -u origin master
git status

我的问题原来是在NTFS位置中使用后斜杠而不是前斜杠,当试图添加原点来设置(新的)跟踪上游分支时。

我必须删除原点使用:

git remote rm origin

然后使用预期的正斜杠再次添加原点

git remote add origin //myserver.mycompany.local/myrepository.git

希望这对将来的人有所帮助。

在我的例子中,bitbucket的web ssh密钥设置UI令人困惑。

存储库设置—>接入键—>添加键:错误

个人设置—> SSH密钥—>添加密钥:Ok

公钥注册界面互斥。您只能在一个地方注册公钥。把它们统一在一个屏幕上似乎很好。

Git需要使用HTTPS:

在终端中输入:

$ git remote set-url origin abc@***.com:path/to/httpURLRepo

然后提交:

$ git add .
$ git commit -m "This is the commit message"

对我来说,这是因为网络。您的网络可能很慢。所以更换网络或排除故障。