LoginSignup
2
1

More than 3 years have passed since last update.

【小ネタ】git-cryptのインストール手順まとめ(Windows/AmazonLinux2/Ubuntu)

Last updated at Posted at 2020-07-08

はじめに

本稿は下記記事からの派生となります。

【GitBash】git-cryptをWindows/Linux環境で活用する【git-crypt】

Gitリポジトリ上のファイルを透過的に暗号化/復号する手段として、git-secretやgit-cryptなどがありますが、プロジェクト内では共通のものを用いる必要があります。
Windows+GitBash環境においては実質的にgit-cryptが選択肢となるため、これにあわせて他の環境用のインストール手順もまとめました。(macOSはありません、すみません。)

git-cryptのGitHubリポジトリは下記になります。
AGWA/git-crypt: Transparent file encryption in git

TL;DR

  • git-cryptの最新版は0.6.0
  • Windowsはバイナリ版の配布があるのでこれを利用する
  • Amazon Linux2は、標準的なリポジトリ(amzn2-core/amzn2extra-epel)にはgit-cryptが無いため、ビルドする
  • Ubuntuはaptリポジトリにgit-cryptがあるためそのまま利用する

インストール手順

Windows+GitBash

git-cryptのWindows版バイナリを作ってくれている方がいるので、これをそのまま利用します。

インストール先は、GitBashのPATHが通っていればどこでも構いません。
上記のREAMDE.md上は、「C:\Program Files\Git\cmd\git-crypt.exe」にインストールしていますが、このフォルダへの書き込みはAdministrator権限が必要なこと、GitBash標準インストールディレクトリであるため、避けます。

今回はユーザプロファイルフォルダの「bin」フォルダにインストールしました。
GitBash上からは「~/bin/」として参照できるディレクトリになります。

$ mkdir ~/bin/

$ ls -1 ~/bin/git-crypt.exe
/c/Users/your-user/bin/git-crypt.exe*

格納後、.bashrcファイル等PATH環境変数を設定しておきます。

Amazon Linux 2

yumリポジトリに存在しないため、ビルドします。
下記、INSTALL.md手順通りに実行することでインストール可能です。

まず、C++コンパイラ、OpenSSLライブラリをインストールします。

$ sudo yum install gcc-c++ openssl-devel -y

次に、git-cryptリポジトリをCloneします。

$ git clone https://github.com/AGWA/git-crypt.git

ビルドします。

$ cd git-crypt/
$ make

インストールします。
/usr/local/binにインストールしたいため、PREFIXは/usr/localとします。

$ sudo make install PREFIX=/usr/local
install -d /usr/local/bin
install -m 755 git-crypt /usr/local/bin/

Ubuntu

aptリポジトリ上に存在するため、そのままインストールします。

$ apt search git-crypt
Sorting... Done
Full Text Search... Done
git-crypt/focal 0.6.0-1build2 amd64
  Transparent file encryption in git
$ sudo apt install git-crypt

macOS

下記記事を見る限り、Macの場合はHomebrewリポジトリにgit-cryptが存在しているようです。

git cryptを導入する - Qiita

2
1
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
2
1