157 lines
3.8 KiB
Markdown
157 lines
3.8 KiB
Markdown
# Unlock with git-crypt
|
|
|
|
The following are the steps unlock the repo in [Linux and Mac](#linux-and-mac) and [Windows](#windows).
|
|
|
|
|
|
*These steps were created using ChatGPT, so there might be some errors.*
|
|
<br>
|
|
*If you run into errors, or if there's any missteps please log an issue here:*
|
|
<br>
|
|
*https://hub.openingdesign.com/OpeningDesign/Bonsai_Tutorials/issues*
|
|
<br>
|
|
*or create a pull request with the change. Thank you.*
|
|
|
|
|
|
|
|
|
|
# Linux and Mac
|
|
|
|
### **Steps to Unlock a Git-Crypt Repository on Linux**
|
|
|
|
#### **1. Open a Terminal {[Linux](Open%20Command%20Prompt%20or%20Git%20Bash.md#linux), [Mac](Open%20Command%20Prompt%20or%20Git%20Bash.md#mac)) in the Repo Folder**
|
|
|
|
Navigate to the top level of your project folder (where `git-crypt` is located):
|
|
|
|
sh
|
|
`cd /path/to/your/repo`
|
|
|
|
#### **2. Run the Unlock Command**
|
|
|
|
If `git-crypt` is installed system-wide, simply run:
|
|
|
|
sh
|
|
`git-crypt unlock`
|
|
|
|
If `git-crypt` is inside the repo and not globally installed, execute it directly:
|
|
|
|
sh
|
|
`./git-crypt unlock`
|
|
|
|
#### **3. If You Get the Error: `no GPG secret key available to unlock this repository`**
|
|
|
|
Import the correct GPG private key:
|
|
|
|
sh
|
|
`gpg --import /path/to/private_key.asc`
|
|
|
|
Example:
|
|
|
|
sh
|
|
`gpg --import ~/keys/secret_key.asc`
|
|
|
|
📌 **Make sure there are no spaces in the file path, or enclose it in quotes:**
|
|
|
|
sh
|
|
`gpg --import "/home/user/My Keys/secret_key.asc"`
|
|
|
|
Then, try unlocking again:
|
|
|
|
sh
|
|
`git-crypt unlock`
|
|
|
|
#### **4. If Unlocking Still Fails, Check Your Repo Path**
|
|
|
|
- Ensure the repository path **does not contain special characters** (`#`, `@`, `!`, `&`), as they can cause issues.
|
|
- Try renaming the folder or cloning the repo to a different location.
|
|
|
|
#### **5. If You Need to Specify a Key File Manually**
|
|
|
|
sh
|
|
`git-crypt unlock /path/to/secretkey.asc`
|
|
|
|
#### **6. If You Get the Error: `path/secretkey.asc: not a valid git-crypt key file`**
|
|
|
|
- Ensure you're using the correct key file.
|
|
- Check for special characters in the repo path and move it if necessary.
|
|
|
|
#### **7. Verify That the Repo is Unlocked**
|
|
|
|
sh
|
|
`git-crypt status`
|
|
|
|
If successful, encrypted files should now be decrypted and accessible.
|
|
|
|
Let me know if you run into any issues! 🚀
|
|
|
|
# Windows
|
|
|
|
### **Steps to Unlock a Git-Crypt Repository on Windows**
|
|
|
|
#### **1. [Open a Command Line](Open%20Command%20Prompt%20or%20Git%20Bash.md#windows) in the Repo Folder**
|
|
|
|
Navigate to the top level of your project folder (where `git-crypt.exe` is located) and open a command line:
|
|
|
|
- **PowerShell:**
|
|
|
|
- Hold down `Shift` + **Right Click** the project folder.
|
|
- Select **"Open PowerShell window here."**
|
|
- Run:
|
|
|
|
sh
|
|
`./git-crypt.exe unlock`
|
|
|
|
- **Git Bash:**
|
|
|
|
- **Right Click** the project folder.
|
|
- Select **"Git Bash Here."**
|
|
- Run:
|
|
|
|
sh
|
|
`./git-crypt.exe unlock`
|
|
|
|
|
|
#### **2. If You Get the Error: `no GPG secret key available to unlock this repository`**
|
|
|
|
You need to import the private key used for encryption:
|
|
|
|
sh
|
|
`gpg --import <path to private key file>`
|
|
|
|
Example:
|
|
|
|
sh
|
|
`gpg --import C:/keys/secret_key.asc`
|
|
|
|
📌 **Make sure the file path has no spaces!**
|
|
|
|
Then, try unlocking again:
|
|
|
|
sh
|
|
`./git-crypt.exe unlock`
|
|
|
|
#### **3. If Unlocking Still Fails, Check Your Repo Path**
|
|
|
|
- Special characters (e.g., `#`, `@`, `!`, `&`) in the repo path can cause issues.
|
|
- Try renaming the folder or cloning the repo to a different location.
|
|
|
|
#### **4. If You Need to Specify a Key File Manually**
|
|
|
|
Try:
|
|
|
|
sh
|
|
`./git-crypt.exe unlock path/to/secretkey.asc`
|
|
|
|
#### **5. If You Get the Error: `path\secretkey.asc: not a valid git-crypt key file`**
|
|
|
|
- Double-check the file path and ensure it's the correct key.
|
|
- Again, check for special characters in the repo path and try relocating the repo.
|
|
|
|
After unlocking successfully, verify with:
|
|
|
|
sh
|
|
`git-crypt status`
|
|
|
|
This should get you up and running! 🚀 Let me know if you hit any snags.
|
|
|
|
|
|
|