我试图设置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/config中有正确的url

url = git@github.com:username/repo.git

如果这是你第一次推,你需要在正确的上游设置

$ git push -u origin master

你可以检查哪个键被使用:

$ ssh -vvv git@github.com

回复应该包含如下内容:

debug1: Next authentication method: publickey
debug1: Offering RSA public key: ~/.ssh/id_rsa
...
You've successfully authenticated, but GitHub does not provide shell access.

也可以在~/中为ssh定义规则。Ssh /config,例如基于别名:

   Host github
      HostName github.com 
      User git
      IdentityFile "~/.ssh/id_rsa"

   Host git
      HostName github.com 
      User git
      IdentityFile "~/.ssh/some_other_id"

您可以为每个别名设置连接到不同的端口,使用不同的用户名等。

其他回答

根据我的经验,这个问题发生的原因之一是因为你的网络连接不稳定。

对我来说,问题和答案就写在我面前。当天早些时候,我编辑了/etc/ssh/ssh_config文件并添加了一些密钥。这个错误说:

/etc/ssh/ssh_config: line 52: Bad configuration option: allowusers
/etc/ssh/ssh_config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.

我删除了allowusers键和它的值,一切都按照预期工作。

我间歇性地遇到这个问题,大多数时候它不会给出错误消息。对我来说,解决方案是在我的LDAP服务器的IP地址改变之后正确地配置LDAP。

的/etc/gitlab/gitlab.LDAP的rb配置指向一个不存在的IP地址,因此更改主机以指向LDAP服务器的正确主机名解决了这个问题。

要诊断问题,使用gitlab-ctl tail命令来帮助您找到堆栈跟踪。对我来说,我找到了这个stacktrace:

==> /var/log/gitlab/gitlab-rails/production.log <==

Net::LDAP::Error (No route to host - connect(2) for 10.10.10.12:389):
  /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/net-ldap-0.16.0/lib/net/ldap/connection.rb:72:in `open_connection'
...

修改/etc/gitlab/gitlab.rb中的主机值

gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
   main: 
     label: 'My LDAP'
     # this was an IP address
     # host: '10.10.10.12'
     host: 'internal-ldap-server' # this is the fix
     port: 389

在更改上面的配置文件之后,一定要重新配置gitlab

gitlab-ctl reconfigure

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

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

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

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

在我的情况下,它是postBuffer..

git config --global http.postBuffer 524288000

参考阅读:https://gist.github.com/marcusoftnet/1177936