フォルダリストをバックアップしてみてください。そのうちのいくつかはgitリポジトリです。

フォルダリストをバックアップしてみてください。そのうちのいくつかはgitリポジトリです。

フォルダのリストがあり、そのいくつかはgitリポジトリです。バックアップするために次のrsyncコマンドを試しました。

LANG=EN_us.UTF-8 rsync -ravdhHP --delete --files-from=rsyncFolders.txt --ignore="node_modules" --ignore="vendor" --include .git --exclude-from="$(if [ `git ls-tree -d --name-only master SRC | wc -l` -eq 1 ]; then git -C SRC ls-files --exclude-standard -oi --directory > .git/ignores.tmp && echo .git/ignores.tmp; fi)" --exclude node_modules --exclude vendor . "/media/pcmagas/79B56D48414DEE1B/pcmagas"

というファイルにバックアップするフォルダがあり、rsyncFolders.txt次の内容があります。

folder_a
folder_b
somefile_txt
code

そのcodeフォルダにはいくつかの.gitリポジトリがあり、junkそこにはたくさんのファイルやフォルダがあるので、バックアップに保存したくないと思います。したがって、私のバックアップロジックは次のようになります。

  1. フォルダが.gitリポジトリの場合、.gitignored ファイルをアーカイブしないでください。
  2. それ以外の場合、*.class一部のJavaファイルがある場合、すべてのファイルは無視されます。 (使用してみたいくつかのサンプルコードの一部)
  3. いかなる状況でもPHPまたはJavaScriptプロジェクトをバックアップしないでくださいnode_modulesvendor

上記のコマンドを実行すると、次のエラーが発生します。

fatal: Not a git repository (or any of the parent directories): .git
rsync: --ignore=node_modules: unknown option
rsync error: syntax or usage error (code 1) at main.c(1572) [client=3.1.1]

どうすればわかりますか?

ベストアンサー1

おすすめ記事