0

First, a (bare) master repo with the name "test" is created in Bitbucket.

Then, a local bare master repo is created on a node with the ip 10.0.0.1:

git clone --bare https://username@bitbucket.org/username/test.git

Then, a local working repo is created on a node with the ip 10.0.0.253:

git clone ssh://username2@10.0.0.1:/home/username2/test.git     

Thus, the work flow within 10.0.0.x is :

(1) code on 10.0.0.253 
(2) at 10.0.0.253, git push to 10.0.0.1
(3) at 10.0.0.1, git push to Bitbucket 

Suppose a local working repo is created outside 10.0.0.x, say 50.113.23.x, and directly from Bitbucket:

mkdir test
cd test
git clone https://username@bitbucket.org/username/test.git

The work flow there is :

(1) code on 50.113.23.x
(2) at 50.113.23.x, git push to Bitbucket 

Now, could you help to comment how to pull updates from the Bitbucket repo to the local bare master repo at 10.0.0.1 ? The following complains fatal: This operation must be run in a work tree:

git pull origin master

The following finishes, but a subsequent git log shows no commits from 50.113.23.x:

 git fetch origin master

Could you help to comment the workaround here ? Many thanks !

SOUser
  • 3,802
  • 5
  • 33
  • 63

1 Answers1

1
git fetch origin master:master

I.e. explicitly update the local master.

phd
  • 82,685
  • 13
  • 120
  • 165
  • Many thanks for your helpful answer ! Could you help to comment where could I learn such knowledge from ? – SOUser Feb 23 '18 at 14:55
  • 1
    Start [here](https://wiki.python.org/moin/Git) and follow tutorials, docs and books. Full disclosure — I am the author of that wiki page. :-) And of course a lot of painful practise. – phd Feb 23 '18 at 14:58
  • Thank you very much again ! – SOUser Feb 23 '18 at 15:31