# Git Setup Guide for Token Lists Push

**Date**: 2026-01-26  
**Purpose**: Configure git remote and push token lists

---

## Current Status

✅ **All token lists committed** (3 commits)  
✅ **All tags created** (3 tags)  
✅ **Git user configured**: defiQUG <defi@defi-oracle.io>  
⚠️ **Remote not configured** - needs setup

---

## Quick Setup (Automated)

Run the configuration script:

```bash
cd /home/intlc/projects/proxmox
./token-lists/scripts/configure-git-remote.sh
```

This script will:
1. Check current git configuration
2. Prompt for repository URL
3. Configure remote
4. Test SSH connection (if using SSH)
5. Optionally push commits and tags

---

## Manual Setup

### Step 1: Configure Remote

**Option A: SSH (Recommended)**

```bash
# Add remote (replace with your repository URL)
git remote add origin git@github.com:username/repo-name.git

# Verify
git remote -v
```

**Option B: HTTPS**

```bash
# Add remote (replace with your repository URL)
git remote add origin https://github.com/username/repo-name.git

# Verify
git remote -v
```

### Step 2: Test Connection

**For SSH:**
```bash
ssh -T git@github.com
# Should see: Hi defiQUG! You've successfully authenticated...
```

**For HTTPS:**
- You'll be prompted for credentials when pushing
- Use Personal Access Token as password

### Step 3: Configure Push Settings

```bash
git config push.default simple
git config push.autoSetupRemote true
```

### Step 4: Push Commits and Tags

```bash
# Check current branch
git branch --show-current

# Push commits (replace 'master' with your branch name)
git push -u origin master

# Push tags
git push origin --tags
```

---

## SSH Key Setup (If Needed)

If SSH authentication is not working:

### 1. Check for existing SSH key

```bash
ls -la ~/.ssh/*.pub
```

### 2. Generate new SSH key (if needed)

```bash
ssh-keygen -t ed25519 -C "defi@defi-oracle.io"
# Press Enter to accept default location
# Set a passphrase (optional but recommended)
```

### 3. Add SSH key to GitHub

```bash
# Display public key
cat ~/.ssh/id_ed25519.pub

# Copy the output, then:
# 1. Go to: https://github.com/settings/keys
# 2. Click "New SSH key"
# 3. Paste the public key
# 4. Click "Add SSH key"
```

### 4. Test SSH connection

```bash
ssh -T git@github.com
```

---

## HTTPS Setup (Alternative)

If you prefer HTTPS:

### 1. Create Personal Access Token

1. Go to: https://github.com/settings/tokens
2. Click "Generate new token (classic)"
3. Select `repo` scope
4. Generate and copy the token

### 2. Configure credential helper

```bash
git config --global credential.helper store
```

### 3. Push (will prompt for credentials)

```bash
git push -u origin master
# Username: defiQUG
# Password: <paste-your-token-here>
```

---

## Verify Configuration

After setup, verify everything:

```bash
# Check remote
git remote -v

# Check commits ready to push
git log --oneline origin/master..HEAD

# Check tags ready to push
git tag -l "token-list-*"

# Test push (dry-run)
git push --dry-run origin master
```

---

## Push Commands

Once configured:

```bash
# Push commits
git push -u origin master

# Push tags
git push origin --tags
```

Or use the helper script:

```bash
./token-lists/PUSH_AND_SUBMIT.sh
```

---

## Troubleshooting

### "Permission denied (publickey)"

- SSH key not added to GitHub
- Run: `ssh-add ~/.ssh/id_ed25519`
- Add key to GitHub: https://github.com/settings/keys

### "Repository not found"

- Check repository URL is correct
- Verify you have push access
- Check repository exists on GitHub

### "Updates were rejected"

- Repository has changes you don't have
- Pull first: `git pull origin master --rebase`
- Then push: `git push origin master`

### "No configured push destination"

- Remote not configured
- Run: `./token-lists/scripts/configure-git-remote.sh`

---

## After Push

Once pushed, token lists will be available at:

- **ChainID 138**: `https://raw.githubusercontent.com/{user}/{repo}/main/token-lists/lists/dbis-138.tokenlist.json`
- **Ethereum Mainnet**: `https://raw.githubusercontent.com/{user}/{repo}/main/token-lists/lists/ethereum-mainnet.tokenlist.json`
- **ALL Mainnet**: `https://raw.githubusercontent.com/{user}/{repo}/main/token-lists/lists/all-mainnet.tokenlist.json`

---

## Next Steps

After successful push:

1. ✅ Verify GitHub Raw URLs are accessible
2. ✅ Sign token lists (optional)
3. ✅ Submit to registries (Uniswap, MetaMask, Chainlist)

---

**Last Updated**: 2026-01-26
