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?

改行文字が勝手に変更されました【Github Actions】

0
Posted at

まえがき

シェルスクリプトの改行文字が勝手に変更されて、実行できなくなったことに関してです

.gitattributesを設定すると正常に動作しました

ほとんど需要はないと思いますが、丸一日引っかかったのでここに残しておきます...

環境

Github Actions で「windows環境で加工 -> linux環境で実行」です
linuxで動かすシェルスクリプト(この時点ではLFでした)を「.gitattributes」なしでリポジトリ上にアップ/actionsで使用しました

原因

簡潔に言うと、windows環境を挟んだからです

windows環境でgitの中身が展開されるとき、ご丁寧にLFからCRLFに変更してくれていました
そのため、明示的に指定してあげると対処できるそうです

原因がわからなかったので、いろいろやって直接実行してあげると、
「#!/usr/bin/env bash\rとは? No such file or directory」というエラーメッセージが出てきました

対処

.gitattributesを設定すると正常に動作しました

*.sh text eol=lf

みたいな感じ?...

おわり

ありがとうございました

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?