2台计算机一个git问题

时间:2017-09-12 03:17:19

标签: git ssh bitbucket

我最近遇到了bitbucket的问题,如果我在工作中使用我的电脑以便在服务器上执行ssh然后执行git pull一切都很完美,但如果我从家用计算机执行此操作,进入同一台服务器,我得到:

  

存储库访问被拒绝。部署密钥与请求的存储库无关。   致命的:无法从远程存储库读取。

     

请确保您拥有正确的访问权限   存储库存在。

这很奇怪,在这种情况下我不知道该怎么做。

OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /home/ubuntu/.ssh/config
debug1: /home/ubuntu/.ssh/config line 1: Applying options for 
bitbucket.org
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to bitbucket.org [104.192.143.1] port 22.
debug1: Connection established.
debug1: identity file /home/ubuntu/.ssh/bitbucket type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ubuntu/.ssh/bitbucket-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: Remote protocol version 2.0, remote software version 
conker_1.0.310-c404db1 app-153
debug1: no match: conker_1.0.310-c404db1 app-153
debug1: Authenticating to bitbucket.org:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256-etm@openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256-etm@openssh.com compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/ubuntu/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: xxx@xxx.xx
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([104.192.143.1]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_PAPER = de_DE.UTF-8
debug1: Sending env LC_ADDRESS = de_DE.UTF-8
debug1: Sending env LC_MONETARY = de_DE.UTF-8
debug1: Sending env LC_NUMERIC = de_DE.UTF-8
debug1: Sending env LC_TELEPHONE = de_DE.UTF-8
debug1: Sending env LC_IDENTIFICATION = de_DE.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_MEASUREMENT = de_DE.UTF-8
debug1: Sending env LC_TIME = de_DE.UTF-8
debug1: Sending env LC_NAME = de_DE.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
authenticated via a deploy key.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

This deploy key has read access to the following repositories:

xxx/xxx: production_server -- xxx@xxx.xx
xxx/yyy: production_server -- xxx@xxx.xx
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3184, received 2008 bytes, in 0.2 seconds
Bytes per second: sent 17457.1, received 11009.4
debug1: Exit status 0

不知怎的,我的印象是在家里我将本地SSH密钥传递给服务器,或者无论如何都有各种各样的东西。 有谁知道我为什么这样做?我怎么能阻止它?谢谢

1 个答案:

答案 0 :(得分:0)

我添加到配置文件

  

IdentitiesOnly yes

所以ssh配置文件看起来像:

Host bitbucket.org
 HostName bitbucket.org
 IdentityFile ~/.ssh/bitbucket
 IdentitiesOnly yes

到服务器,现在正在运行。