@ -351,7 +351,7 @@ See `docs/SECURITY.md` and `docs/SECURITY_IMPLEMENTATION.md` for detailed inform
@@ -351,7 +351,7 @@ See `docs/SECURITY.md` and `docs/SECURITY_IMPLEMENTATION.md` for detailed inform
## Environment Variables
- `NOSTRGIT_SECRET_KEY_CLIENT`: User's nsec (bech32 or hex) for client-side git operations via credential helper (optional)
- `NOSTRGIT_SECRET_KEY`: User's nsec (bech32 or hex) for client-side git operations via credential helper (optional)
- `GIT_REPO_ROOT`: Path to store git repositories (default: `/repos`)
- `GIT_DOMAIN`: Domain for git repositories (default: `localhost:6543`)
- `NOSTR_RELAYS`: Comma-separated list of Nostr relays (default: `wss://theforest.nostr1.com`)
@ -14,7 +14,7 @@ GitRepublic uses NIP-98 HTTP Authentication for git operations. The credential h
@@ -14,7 +14,7 @@ GitRepublic uses NIP-98 HTTP Authentication for git operations. The credential h
chmod +x scripts/git-credential-nostr.js
```
### 2. Set your NOSTRGIT_SECRET_KEY_CLIENT environment variable
### 2. Set your NOSTRGIT_SECRET_KEY environment variable
**Important:**
- This is YOUR user private key (for authenticating your git operations)
**Note:** The git HTTP backend endpoint is `/api/git/`, so the full URL format is:
@ -145,7 +145,7 @@ git push -u origin main
@@ -145,7 +145,7 @@ git push -u origin main
### Push changes
```bash
git push origin main
git push gitrepublic-web main
```
The credential helper will generate the appropriate NIP-98 auth token for push operations.
@ -153,14 +153,14 @@ The credential helper will generate the appropriate NIP-98 auth token for push o
@@ -153,14 +153,14 @@ The credential helper will generate the appropriate NIP-98 auth token for push o
### Fetch/Pull
```bash
git fetch origin
git pull origin main
git fetch gitrepublic-web
git pull gitrepublic-web main
```
## How It Works
1. When git needs credentials, it calls the credential helper with the repository URL
2. The helper reads your `NOSTRGIT_SECRET_KEY_CLIENT` environment variable (with fallbacks for backward compatibility)
2. The helper reads your `NOSTRGIT_SECRET_KEY` environment variable (with fallbacks for backward compatibility)
3. It creates a NIP-98 authentication event signed with your private key
4. The signed event is base64-encoded and returned as the "password"
5. Git sends this in the `Authorization: Nostr <base64-event>` header
@ -168,14 +168,14 @@ git pull origin main
@@ -168,14 +168,14 @@ git pull origin main
## Troubleshooting
### Error: NOSTRGIT_SECRET_KEY_CLIENT environment variable is not set
### Error: NOSTRGIT_SECRET_KEY environment variable is not set
Make sure you've exported the NOSTRGIT_SECRET_KEY_CLIENT variable:
Make sure you've exported the NOSTRGIT_SECRET_KEY variable:
```bash
export NOSTRGIT_SECRET_KEY_CLIENT="nsec1..."
export NOSTRGIT_SECRET_KEY="nsec1..."
```
**Note:** The script also supports `NOSTR_PRIVATE_KEY` and `NSEC` for backward compatibility, but `NOSTRGIT_SECRET_KEY_CLIENT` is the preferred name.
**Note:** The script also supports `NOSTR_PRIVATE_KEY` and `NSEC` for backward compatibility, but `NOSTRGIT_SECRET_KEY` is the preferred name.
### Error: Invalid nsec format
@ -195,12 +195,12 @@ Push operations require POST authentication. The credential helper automatically
@@ -195,12 +195,12 @@ Push operations require POST authentication. The credential helper automatically
1. Verify you have maintainer permissions for the repository
2. Check that branch protection rules allow your push
3. Ensure your NOSTRGIT_SECRET_KEY_CLIENT is correctly set
3. Ensure your NOSTRGIT_SECRET_KEY is correctly set
## Security Best Practices
1. **Never commit your NOSTRGIT_SECRET_KEY_CLIENT to version control**
- Add `NOSTRGIT_SECRET_KEY_CLIENT` to your `.gitignore` if you store it in a file
1. **Never commit your NOSTRGIT_SECRET_KEY to version control**
- Add `NOSTRGIT_SECRET_KEY` to your `.gitignore` if you store it in a file
- Use environment variables instead of hardcoding
- **Important:** This is YOUR user key for client-side operations