0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

git で master で tag を作ってしまったときに削除する

Posted at

背景

GitHub Actions などで, github.ref で tag を打つ(たとえば artifact を release にアップロードするときとか)ようなスクリプトを書いている.

master branch を push すると refs/heads/master で tag が作られ, 以降手元から git push origin master などすると

error: dst refspec refs/heads/master matches more than one.

となり push できない.

解決方法

git push origin :refs/tags/refs/heads/master で消す.

refs/heads/master がタグ名になっているので, :refs/tags + refs/heads/master とする
(refs/tags/master ではうまく消せない)

その他

githhub actions で, branch or tag 名を見て処理を切り替えるには if を使う

if: contains(github.ref, 'tags/v')

YAML だと, 条件で処理変える文法がわかりづらいですね.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?