← 返回命令列表

Linux command

git-crypt 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Initialize git-crypt in repo

git-crypt init

Add GPG user

git-crypt add-gpg-user [user@example.com]

Unlock repository

git-crypt unlock

Lock repository

git-crypt lock

Export symmetric key

git-crypt export-key [/path/to/key]

Unlock with key file

git-crypt unlock [/path/to/key]

说明

git-crypt enables transparent encryption of files in a Git repository. Configured files are encrypted when committed and decrypted when checked out, allowing sensitive data to be stored securely alongside regular code. Encryption is configured via .gitattributes patterns. Users with the symmetric key or authorized GPG keys can unlock the repository to view and edit protected files.

参数

init
Initialize git-crypt in repository.
add-gpg-user _user_
Add GPG user who can unlock.
unlock _keyfile_
Decrypt encrypted files.
lock
Re-encrypt files.
export-key _file_
Export symmetric key.
status _-e_|_-u_
Show encryption status of files.

FAQ

What is the git-crypt command used for?

git-crypt enables transparent encryption of files in a Git repository. Configured files are encrypted when committed and decrypted when checked out, allowing sensitive data to be stored securely alongside regular code. Encryption is configured via .gitattributes patterns. Users with the symmetric key or authorized GPG keys can unlock the repository to view and edit protected files.

How do I run a basic git-crypt example?

Run `git-crypt init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does init do in git-crypt?

Initialize git-crypt in repository.