This guide shows you how to use Personal Access Tokens with Git from the command line.
Basic Authentication
When Prompted
When you clone, push, or pull from a private repository, Git will prompt you:
$ git clone https://cuebes.com/username/repo.git
Username for 'https://cuebes.com': your-username
Password for 'https://your-username@cuebes.com': [paste your token]
Credential Storage
macOS - Keychain
Store credentials in macOS Keychain (most secure):
git config --global credential.helper osxkeychain
Next time you authenticate, credentials will be saved automatically.
Windows - Credential Manager
git config --global credential.helper manager
Linux - Cache (Temporary)
Cache credentials in memory for 1 hour:
git config --global credential.helper 'cache --timeout=3600'
Linux - Store (Permanent)
Store credentials in a file (less secure):
git config --global credential.helper store
store helper saves credentials in plain text at ~/.git-credentials. Use with caution.
URL-Based Authentication
Include Token in Clone URL
For scripts or one-time use:
git clone https://username:TOKEN@cuebes.com/username/repo.git
Update Existing Remote
Add authentication to an existing repository:
git remote set-url origin https://username:TOKEN@cuebes.com/username/repo.git
View Current Remote
git remote -v
Environment Variables
For Scripts and CI/CD
Use environment variables for automation:
export CUEBES_TOKEN="your-personal-access-token"
git clone https://username:$CUEBES_TOKEN@cuebes.com/username/repo.git
In CI/CD Pipelines
Most CI systems support secret environment variables. Example for a shell script:
#!/bin/bash
git clone https://${CUEBES_USER}:${CUEBES_TOKEN}@cuebes.com/org/repo.git
cd repo
# ... your build commands
Git Credential Commands
Clear Stored Credentials
macOS
git credential-osxkeychain erase
host=cuebes.com
protocol=https
(Press Enter twice after the last line)
Generic
git credential reject
host=cuebes.com
protocol=https
Test Credentials
git credential fill
host=cuebes.com
protocol=https
SSH Alternative
While CUEBES primarily uses HTTPS with tokens, the same security principles apply. Tokens are preferred because:
- Easier to manage and revoke
- Granular permissions (read vs write)
- Expiration support
- Works through most firewalls
Common Commands Quick Reference
# Clone
git clone https://cuebes.com/username/repo.git
# Add changes
git add .
# Commit
git commit -m "Your message"
# Push
git push origin main
# Pull latest
git pull origin main
# Check status
git status
Troubleshooting
403 Forbidden
Usually means authentication succeeded but you don't have permission:
- Check token has "Write" permission for pushing
- Verify you have collaborator access to the repo
401 Unauthorized
Authentication failed:
- Verify you're using your token, not your password
- Check the token hasn't expired
- Try creating a new token