Skip to content

Commit a2124fa

Browse files
committed
feat: Add comprehensive Git credential manager for Linux
- Automatic detection of available credential helpers - Smart selection of most secure available option - Platform-specific support (Libsecret, Keychain, Windows Credential Store) - Support for Cache, Store, and Git Credential Manager - Custom credential helper configuration - New UI in Preferences with dropdown selector - Detailed documentation for setup and troubleshooting This solves the common Linux problem where users have to repeatedly enter credentials for each Git operation. The system now auto-detects and configures the best available credential helper. Closes issues related to credential persistence on Linux
1 parent 41ed90a commit a2124fa

File tree

9 files changed

+779
-10
lines changed

9 files changed

+779
-10
lines changed

RELEASE_NOTES.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
# SourceGit Iniationware Edition - Release Notes
22

3-
## Version 2025.34-IW.3
3+
## Version 2025.34-IW.4
4+
5+
### What's New in IW.4
6+
This release introduces comprehensive Git credential management to solve the common problem on Linux where users have to repeatedly enter credentials. The new system auto-detects and configures the best available credential helper for your platform.
7+
8+
### Major New Feature: Git Credential Manager
9+
- **Automatic Detection**: Discovers all available credential helpers on your system
10+
- **Smart Selection**: Automatically chooses the most secure option available
11+
- **Platform-Specific Support**:
12+
- Linux: Libsecret (GNOME Keyring/KWallet) support
13+
- macOS: Native Keychain integration
14+
- Windows: Credential Store integration
15+
- **Multiple Options**: Support for Cache (memory), Store (file), and Git Credential Manager
16+
- **Custom Helpers**: Configure any custom credential helper command
17+
- **User-Friendly UI**: New credential manager dropdown in Preferences → Git tab
18+
- **Security-First**: Prioritizes secure storage methods over convenience
19+
20+
This feature is especially beneficial for Linux users who previously had to enter credentials repeatedly for each Git operation.
21+
22+
## Version 2025.34-IW.3 (Previous Release)
423

524
### What's New in IW.3
625
This critical patch release focuses on stability improvements, integrating important bug fixes from upstream SourceGit. These fixes address crashes, UI reliability issues, and functional improvements that significantly enhance the application's stability.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025.34-IW.3
1+
2025.34-IW.4

docs/CREDENTIAL_MANAGER.md

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
# Git Credential Manager Documentation
2+
3+
## Overview
4+
5+
SourceGit now includes comprehensive Git credential management to solve the common problem on Linux (and other platforms) where users have to repeatedly enter their credentials for each Git operation.
6+
7+
## Features
8+
9+
### Automatic Detection
10+
- **Auto-discovery**: Automatically detects available credential helpers on your system
11+
- **Smart Selection**: Chooses the most secure available option by default
12+
- **Cross-platform**: Works on Windows, macOS, and Linux with platform-specific optimizations
13+
14+
### Supported Credential Helpers
15+
16+
#### 1. **None**
17+
- No credential storage
18+
- Will prompt for credentials each time
19+
- Most secure but least convenient
20+
21+
#### 2. **Git Credential Manager (GCM)**
22+
- Cross-platform credential manager from Microsoft
23+
- Supports multi-factor authentication
24+
- Works with GitHub, Azure DevOps, Bitbucket, and more
25+
- **Recommended for most users**
26+
27+
#### 3. **Cache**
28+
- Stores credentials in memory temporarily
29+
- Default timeout: 1 hour
30+
- Good balance of security and convenience
31+
- No persistent storage on disk
32+
33+
#### 4. **Store**
34+
- Saves credentials to a file on disk
35+
- **Warning**: Stores passwords in plain text
36+
- Only use on secure, single-user systems
37+
- File location: `~/.sourcegit/data/.git-credentials`
38+
39+
#### 5. **Platform-Specific Options**
40+
41+
##### Linux: Libsecret
42+
- Integrates with GNOME Keyring or KWallet
43+
- Secure encrypted storage
44+
- Automatically unlocked when you log in
45+
- **Recommended for Linux desktop users**
46+
47+
##### macOS: Keychain
48+
- Uses the native macOS Keychain
49+
- Secure, encrypted storage
50+
- Integrated with system security
51+
- **Recommended for macOS users**
52+
53+
##### Windows: Windows Credential Store
54+
- Uses Windows Credential Manager
55+
- Secure, encrypted storage
56+
- Integrated with Windows security
57+
- **Recommended for Windows users**
58+
59+
#### 6. **Custom**
60+
- Specify your own credential helper command
61+
- For advanced users with specific requirements
62+
- Supports any git-credential-* helper
63+
64+
## Configuration
65+
66+
### Via UI
67+
68+
1. Open **Preferences** (Ctrl/Cmd + ,)
69+
2. Navigate to the **Git** tab
70+
3. Find the **Credential Helper** dropdown
71+
4. Select your preferred credential helper
72+
5. For custom helpers, enter the command in the text field that appears
73+
74+
### Automatic Configuration
75+
76+
SourceGit automatically:
77+
1. Detects available credential helpers on startup
78+
2. Selects the most secure available option
79+
3. Applies the configuration to all Git operations
80+
81+
### Priority Order
82+
83+
When multiple helpers are available, SourceGit selects based on this priority:
84+
1. Git Credential Manager Core
85+
2. Git Credential Manager
86+
3. Libsecret (Linux)
87+
4. macOS Keychain (macOS)
88+
5. Windows Credential Store (Windows)
89+
6. Cache (memory-based)
90+
7. Store (file-based)
91+
8. None
92+
93+
## Linux-Specific Setup
94+
95+
### Installing Credential Helpers
96+
97+
#### Ubuntu/Debian
98+
```bash
99+
# For Git Credential Manager
100+
curl -sSL https://aka.ms/gcm/linux-install-source.sh | sh
101+
git-credential-manager configure
102+
103+
# For Libsecret
104+
sudo apt-get install libsecret-1-0 libsecret-1-dev
105+
sudo apt-get install git-credential-libsecret
106+
```
107+
108+
#### Fedora/RHEL
109+
```bash
110+
# For Git Credential Manager
111+
curl -sSL https://aka.ms/gcm/linux-install-source.sh | sh
112+
git-credential-manager configure
113+
114+
# For Libsecret
115+
sudo dnf install libsecret libsecret-devel
116+
sudo dnf install git-credential-libsecret
117+
```
118+
119+
#### Arch Linux
120+
```bash
121+
# For Git Credential Manager
122+
yay -S git-credential-manager-core-bin
123+
124+
# For Libsecret
125+
sudo pacman -S libsecret
126+
sudo pacman -S git-credential-libsecret
127+
```
128+
129+
### Troubleshooting Linux Credential Issues
130+
131+
#### Problem: Credentials not persisting
132+
**Solution**:
133+
1. Check if a keyring daemon is running:
134+
```bash
135+
ps aux | grep -E 'gnome-keyring|kwallet'
136+
```
137+
2. If not, start it:
138+
```bash
139+
# For GNOME
140+
gnome-keyring-daemon --start --daemonize
141+
142+
# For KDE
143+
kwalletd5 &
144+
```
145+
146+
#### Problem: "No credential helper is configured"
147+
**Solution**:
148+
1. Open SourceGit Preferences
149+
2. Select a credential helper from the dropdown
150+
3. Restart SourceGit
151+
152+
#### Problem: Libsecret not working
153+
**Solution**:
154+
1. Ensure libsecret is installed correctly
155+
2. Check if the keyring is unlocked
156+
3. Try using the Cache helper as a fallback
157+
158+
## Security Recommendations
159+
160+
### Best Practices
161+
162+
1. **Use platform-specific secure storage** when available:
163+
- Linux: Libsecret
164+
- macOS: Keychain
165+
- Windows: Credential Store
166+
167+
2. **Avoid the Store helper** unless:
168+
- You're on a secure, single-user system
169+
- The repository contains only public data
170+
- You understand the security implications
171+
172+
3. **Use Cache for temporary access**:
173+
- Good for shared systems
174+
- Credentials expire after timeout
175+
- No persistent storage
176+
177+
4. **Configure timeout for Cache**:
178+
- Default: 3600 seconds (1 hour)
179+
- Adjust based on your security needs
180+
181+
### Personal Access Tokens
182+
183+
For enhanced security with services like GitHub:
184+
1. Use Personal Access Tokens instead of passwords
185+
2. Generate tokens with minimal required permissions
186+
3. Set expiration dates on tokens
187+
4. Store tokens securely using credential helpers
188+
189+
## Implementation Details
190+
191+
### How It Works
192+
193+
1. **Detection Phase**: On startup, SourceGit checks for available credential helpers
194+
2. **Selection Phase**: Chooses the best available helper based on security and platform
195+
3. **Configuration Phase**: Sets the credential helper for all Git operations
196+
4. **Runtime Phase**: Git uses the configured helper for all remote operations
197+
198+
### Technical Architecture
199+
200+
The credential manager system consists of:
201+
- `Models/CredentialManager.cs`: Core credential manager logic
202+
- `Views/Preferences.axaml`: UI for credential helper selection
203+
- `Native/OS.cs`: Platform-specific credential helper integration
204+
- `Commands/Command.cs`: Git command execution with credential helper
205+
206+
### Git Command Integration
207+
208+
All Git commands executed by SourceGit include:
209+
```bash
210+
git -c credential.helper=[selected-helper] [command]
211+
```
212+
213+
This ensures consistent credential handling across all operations.
214+
215+
## Frequently Asked Questions
216+
217+
### Q: Why do I still get prompted for credentials?
218+
**A**: This can happen if:
219+
- No credential helper is configured
220+
- The credential helper is not installed properly
221+
- Your stored credentials have expired
222+
- You're accessing a new repository/remote
223+
224+
### Q: Is it safe to use the Store helper?
225+
**A**: The Store helper saves passwords in plain text. Only use it on:
226+
- Secure, single-user systems
227+
- Systems with encrypted disk storage
228+
- For repositories without sensitive data
229+
230+
### Q: Can I use multiple credential helpers?
231+
**A**: Git supports credential helper chaining, but SourceGit currently configures one helper at a time for simplicity and predictability.
232+
233+
### Q: How do I clear stored credentials?
234+
**A**: Depends on the helper:
235+
- **Cache**: Restart SourceGit or wait for timeout
236+
- **Store**: Delete `~/.git-credentials` or the configured file
237+
- **Libsecret/Keychain**: Use system tools to manage stored passwords
238+
- **GCM**: Run `git credential-manager erase`
239+
240+
## Support
241+
242+
If you encounter issues with credential management:
243+
1. Check the credential helper dropdown in Preferences
244+
2. Verify the helper is installed correctly
245+
3. Try a different credential helper
246+
4. Report issues at: https://github.com/sourcegit-scm/sourcegit/issues

0 commit comments

Comments
 (0)