Track remote branch

把目前使用中,而且沒有git的資料夾track remote branch

  1. 連線的PC or server要有SSH Key, 並且把Public key的內容貼到Bitbucket的Repo設定裡
    1. Step by step tutorial: https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html
  2. Git commands to track remote branch
    1. git init
    2. git add . git commit -m ‘some comment’
    3. git remote add origin git@gitserver:/opt/git/project.gitReference
    4. Maybe git checkout master will do.

Fix “detached HEAD” error

https://gitbook.tw/chapters/faq/detached-head.html

Fix “refusing to merge unrelated histories” error:

git pull origin master --allow-unrelated-histories

Reference:

  1. https://stackoverflow.com/questions/24916708/track-existing-folder-from-remote-git-repo
  2. Track Remote Branch https://stackoverflow.com/questions/520650/make-an-existing-git-branch-track-a-remote-branch
  3. Common commands related to remote https://backlog.com/git-tutorial/tw/reference/remote.html