Category Archives: Git

Track remote branch

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

  1. 連線的PC or server要有SSH Key, 並且把Public key的內容貼到Bitbucket的Repo設定裡
    1. Step by step tutorial:
  2. Git commands to track remote branch
    1. git init
    2. git add .
    3. git commit -m ‘Init git’
      (Current branch is master)
    4. git remote add origin git@gitserver:/opt/git/project.gitReference
    5. git branch -u origin/master

Fix “detached HEAD” error

Fix “refusing to merge unrelated histories” error:


  2. Track Remote Branch
  3. Common commands related to remote

Git related commands


push.default warning

Ignored files still display in git status?


Clone a repository from GitLab with SSH

  1. Create a SSH key (Git bash is recommended):
  2. Login Gitlab and paste SSH key in account page
  3. Execute clone command:
  4. Then you can create a new repo in Source Tree or Github Desktop