Pulling git repository from local to remote

Issue

I currently have been working on a branch of a bitbucket repository locally on my computer, I need to update the same branch on a remote HPC system, I thought it was a simple as committing and pushing locally and then pulling on the HPC system but it still not in sync. The changes do appear when I am on the bitbucket repository but are not being updated on the remote system.

I was wondering how to approach this properly:

git branch

  development
* bugfix/xyz

I first push on my local system:

git push
Everything up-to-date

then I ran the following git steps on my command line when I’m on my remote server:

git checkout -b bugfix/xyz
git pull 

get the following:

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> bugfix/xyz

but running git remote show origin on the HPC it says the following:

* remote origin
  Fetch URL: git@bitbucket.org:server/pipeline.git
  Push  URL: git@bitbucket.org:server/pipeline.git
  HEAD branch (remote HEAD is ambiguous, may be one of the following):
    development
  Remote branches:
    bugfix/xyz           tracked

Solution

You should do
git branch --set-upstream-to=origin/bugfix/xyz bugfix/xyz

to fix your issue.

Personally I never user git pull, I really prefer git fetch to get what has changed on the remote. And then checkout and track a remote branch

Answered By – Ôrel

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published