Source and remote issues
This guide helps you resolve common issues when using remote repositories for sources (pulling rules) and remotes (pushing backups) in AlignTrue.
For conceptual guidance, see Rule sharing & privacy.
Quick checks
- Validate config:
aligntrue check - Get verbose output:
aligntrue sync --verbose - Verify the ref exists:
git ls-remote --heads <url> <ref>
Git source issues
Repository not found
Error:
fatal: repository 'https://github.com/user/repo.git' not foundCauses:
- Repository doesn’t exist
- Wrong URL
- No access to private repository
- Using HTTPS without credentials
Solutions:
-
Verify the repository exists on your git host
-
Check the URL in your config:
sources: - type: git url: https://github.com/user/repo.git ref: main -
For private repos, use SSH instead of HTTPS:
sources: - type: git url: git@github.com:user/repo.git ref: main -
Verify you have access:
git ls-remote git@github.com:user/repo.git
Branch not found
Error:
fatal: couldn't find remote ref mainCause: Branch name mismatch (main vs master) or a typo in ref.
Solution:
-
List branches on the remote:
git ls-remote --heads git@github.com:user/repo.git -
Confirm the branch you need exists (
main,master, or a feature branch). -
Update the branch in your config:
sources: - type: git url: git@github.com:user/repo.git ref: master # Set to the actual branch name -
Sync again:
aligntrue sync
Clone failure in cache
Error:
fatal: unable to clone from .aligntrue/.cache/remotes/...Cause: Previous clone attempt failed or cache is corrupted.
Solution:
-
Clear the cached clone for the affected remote (safe to delete; cache is transient):
rm -rf .aligntrue/.cache/remotes/<host>/<repo> -
Sync again:
aligntrue sync
Remote backup configuration
Setting up remotes
Remotes route your rules to backup git repositories. Configure in .aligntrue/config.yaml:
remotes:
personal: git@github.com:youruser/personal-rules.git
# or with options:
shared:
url: git@github.com:company/shared-rules.git
branch: main # Set if your backup repo uses a non-default branchScopes:
- Remote keys must match rule scopes:
personal- Rules withscope: personalpush hereshared- Rules withscope: sharedpush here
branchdefaults tomain; set it if the backup repo uses another branch.
Team mode notes:
- One scope per rule. To push to multiple destinations, keep one scope and add
remotes.custom[]entries (pattern-based, additive). remotes.sharedtypically lives inconfig.team.yaml;remotes.personallives in personalconfig.yaml.remotes.customconcatenate from both files.
Invalid remotes configuration
Error:
Error: Invalid remotes configurationSolution:
Ensure remotes are properly formatted:
remotes:
personal: git@github.com:user/repo.git # Simple string format
shared: # Or object format
url: git@github.com:company/repo.git
branch: main # Optional, defaults to "main"Missing remotes.personal
Error:
personal-scope file(s) have no remote configured. Add remotes.personal to route them.Cause: Rules marked scope: personal but no personal remote configured.
Solution:
Add personal remote to config:
remotes:
personal: git@github.com:youruser/personal-rules.gitOr remove scope: personal from rules if you don’t need to push them to a personal remote.
SSH issues
Permission denied (publickey)
Error:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.Cause: SSH key not configured or not added to your git host.
Solution:
-
Check if you have an SSH key:
ls -la ~/.ssh -
If no key exists, generate one:
ssh-keygen -t ed25519 -C "your_email@example.com" -
Add the key to your SSH agent:
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519 -
Copy your public key:
cat ~/.ssh/id_ed25519.pub -
Add it to your git host:
- GitHub: github.com/settings/keys
- GitLab: Profile → SSH Keys
- Bitbucket: Personal settings → SSH keys
-
Test the connection:
ssh -T git@github.com
SSH Key Passphrase Prompts
Problem: SSH keeps asking for passphrase on every operation.
Solution:
Add your key to the SSH agent permanently:
macOS:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519Add to ~/.ssh/config:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519Linux:
ssh-add ~/.ssh/id_ed25519Add to ~/.bashrc or ~/.zshrc:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519 2>/dev/nullWindows:
# Start SSH agent service
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
# Add key
ssh-add $HOME\.ssh\id_ed25519Wrong host key
Error:
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!Cause: Server’s SSH key changed (or potential security issue).
Solution:
-
Verify the change is legitimate (check with your git host)
-
Remove the old key:
ssh-keygen -R github.com -
Reconnect and accept the new key:
ssh -T git@github.com
Push/Pull issues
Push rejected
Error:
! [rejected] main -> main (fetch first)
error: failed to push some refsCause: Remote has changes you don’t have locally.
Solution:
-
Pull changes first:
git pull origin main -
If there are conflicts, resolve them:
git status # Edit conflicting files git add . git commit -m "Resolve conflicts" -
Verify clean state, then push:
git status aligntrue check aligntrue sync
Merge conflicts
Error:
CONFLICT (content): Merge conflict in rules.md
Automatic merge failedSolution:
-
Pull and inspect the conflict:
git pull origin main git status -
Edit conflicting files:
# Open conflicting files and resolve # Remove conflict markers: <<<<<<<, =======, >>>>>>> -
Complete the merge:
git add . git commit -m "Resolve merge conflict" git status aligntrue sync # If you get stuck, you can abort the merge: # git merge --abort
Diverged branches
Error:
Your branch and 'origin/main' have divergedCause: Local and remote have different commits.
Solution:
-
Pull with rebase:
git pull --rebase origin main -
If conflicts, resolve them and continue:
git rebase --continue -
Push:
git push origin main
HTTPS issues
Authentication failed
Error:
fatal: Authentication failed for 'https://github.com/user/repo.git'Solutions:
Option 1: Use SSH (Recommended)
sources:
- type: git
url: git@github.com:user/repo.git
ref: main
remotes:
personal: git@github.com:user/repo.gitOption 2: Use Personal Access Token
-
Create a token (minimum scopes:
repofor private GitHub repos):- GitHub: Settings → Developer settings → Personal access tokens
- GitLab: Profile → Access Tokens
- Bitbucket: Personal settings → App passwords
-
Configure a secure credential helper:
# macOS git config --global credential.helper osxkeychain # Windows git config --global credential.helper manager-core # Linux (temporary cache for 1 hour) git config --global credential.helper 'cache --timeout=3600' -
On next push, enter:
- Username: your username
- Password: your token (not your actual password)
Option 3: Use temporary credential cache (short-lived)
git config --global credential.helper 'cache --timeout=3600'Token expired
Error:
remote: Invalid username or password.Cause: Personal access token expired.
Solution:
-
Generate a new token on your git host
-
Update stored credentials:
# Remove old credentials git credential reject <<EOF protocol=https host=github.com EOF # Next push will prompt for new token
Network issues
Connection timeout
Error:
fatal: unable to access 'https://github.com/user/repo.git/':
Failed to connect to github.com port 443: Connection timed outSolutions:
-
Check your internet connection
-
Check if git host is accessible:
ping github.com -
Try SSH instead of HTTPS:
url: git@github.com:user/repo.git -
Check firewall/proxy settings
-
If behind corporate proxy, configure git:
git config --global http.proxy http://proxy.company.com:8080
SSL Certificate Problem
Error:
SSL certificate problem: unable to get local issuer certificateSolutions:
Option 1: Update CA certificates (Recommended)
# macOS
brew install ca-certificates
# Ubuntu/Debian
sudo apt-get update && sudo apt-get install ca-certificates
# Windows
# Download and install latest Git for WindowsOption 2: Disable SSL verification (Not Recommended)
Warning: Disable only while diagnosing, and re-enable after fixing CA issues.
git config --global http.sslVerify false
# Re-enable once fixed
git config --global --unset http.sslVerifyOption 3: Use SSH
SSH doesn’t use SSL certificates, so this avoids the issue entirely.
Permission issues
Permission denied (repository)
Error:
remote: Permission to user/repo.git deniedCause: No write access to the repository.
Solutions:
-
Verify you own the repository or have write access
-
Check repository settings on your git host
-
If using organization repo, ensure you’re a member
-
Create a new repository under your account:
# On GitHub gh repo create aligntrue-personal-rules --private # Update remotes config with new URL
File permission errors
Error:
error: unable to create file rules.md: Permission deniedCause: File system permissions issue.
Solution:
# Check ownership
ls -la .aligntrue/.cache/remotes/
# Fix ownership (replace USER with your username)
chown -R "$USER":"$USER" .aligntrue/.cache/ # use sudo only if required
# Or clear cache and retry
rm -rf .aligntrue/.cache/remotes
aligntrue syncGetting more help
If you’re still stuck:
-
Validate configuration:
aligntrue check -
Check AlignTrue logs:
aligntrue sync --verbose -
Test git access directly:
git remote -v git fetch origin -
Check git configuration:
git config --list -
Review git host status:
- GitHub: githubstatus.com
- GitLab: status.gitlab.com