commits_behindgit rev-list --count HEAD..origin/master to fetch the difference in number
The problem is that when I run the command of commit_behind in command line inside docker container plugin repository, I get 0.
But there are actually some commits made in the bitbucket private repository.
When I check locally in my machine, I rightly get the commits_behind number as 2.
I have added the ssh keys in /root/.ssh folder for the bitbucket repo. I am not able to understand why would the git command show 0 inside docker container (incorrect) but 2 in local machine(correct)
This might be obvious, but have you checked that the ssh directory and files in it have tight permissions? That’s something ssh is picky about, and probably git using ssh, too. Mode 700 on directory, 600 on files is tight.
What happens if you try to ssh to the git repo host from inside your app?
cd /var/discourse
./launcher enter app
ssh -v user@github.com.or.wherever
The last few lines for me look like:
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 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: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
(I created an id_rsa key for this test, but it isn’t on gitbhub.) Do you see the key being offered?
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([104.XXX.XXX.1]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
PTY allocation request failed on channel 0
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.