我试图设置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 

其他回答

user@server:/etc/nginx$ cat .git/config 
...
[remote "origin"]
    url = git@gitlab.com:user/.git
    fetch = +refs/heads/*:refs/remotes/origin/*
...

使用ssh代替https。 在git中使用ssh密钥(添加ssh密钥)。 如果您是root用户,请使用ssh密钥。


$ sudo ssh-keygen
$ cat /root/.ssh/id_rsa.pub 

$ git init
$ git add file
$ git commit -m "add first file"
$ git remote add origin git@gitlab.com:user/example.git 
$ git push -u origin master

在我的情况下,我试图克隆与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,它工作。

我也遇到了同样的问题,通过更新到最新的git版本解决了这个问题

可能是网络问题。

尝试执行ssh -vvvT git@gitlab.com。如果服务器意外挂起,可能是网络连接有问题。

将以下代码放到~/.ssh/config中

IPQoS lowdelay throughput

在我的情况下,我使用ssh密钥与密码验证与github。我没有在Windows中正确地设置pageant(只有在cygwin中)。缺少的步骤是将git_ssh环境变量指向plink.exe。此外,你需要得到github.com到plink known_hosts。

   plink github.com
   y
   <then ctrl-c>

希望这能有所帮助!

我当然希望intellij能给我一个更有用的错误,或者让我输入ssh密钥密码。