git 範例

git 分支, 合併, tag 之範例

# 建立 develop branch
git branch develop
git checkout develop
git branch

for t in {1..5};
do
  TAG=v0.${t}
  FEATURE=feature/${TAG}

  # 建立 feature branch
  git branch ${FEATURE}
  git checkout ${FEATURE}
  git branch

  # commit 5個版本
  for i in {1..5};
  do
    data=$(printf "${FEATURE}-%03d" $i)
    echo $data >> history.txt
    history=$(cat history.txt)
    printf "# Test\n## Version\n${data}\n## History\n\`\`\`\n${history}\n\`\`\`\n" > readme.md
    git add .
    git commit -m "version: ${data}"
    git push -u origin ${FEATURE}
  done
  git branch

  # 切換develop
  git checkout develop
  git branch

  # 合併
  git merge --no-ff -m "合併(from ${FEATURE} to develop)" ${FEATURE}
  git push -u origin develop

  # 刪除分支
  git branch -d ${FEATURE}
  git push -u origin :${FEATURE}
  git push -u origin develop

  # 切換到master
  git checkout master
  git branch

  # 合併
  git merge --no-ff -m "合併(from 合併 to master)" develop
  git push -u origin master

  # 建立release
  git tag ${TAG}
  git tag -l
  git push origin ${TAG}
done

gitlab runner 500錯誤

解決辦法1

gitlab-rails console
Ci::Runner.all.update_all(token_encrypted: nil)

並重啟gitlab

解決辦法2

gitlab-rails dbconsole
gitlabhq_production=> UPDATE projects SET runners_token = null, runners_token_encrypted = null;
gitlabhq_production=> UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
gitlabhq_production=> UPDATE application_settings SET runners_registration_token_encrypted = null;

並重啟gitlab

reference

https://blog.csdn.net/qq_15904277/article/details/90751271

chmod 設定權限

設定test資料夾下的所有檔案權限

find test -type f -exec chmod 644 {} +

設定test資料夾下的所有資料夾權限

find test -type d -exec chmod 755 {} +