# How to Update Remote Origin ## Method 1: Change Existing Remote URL (Recommended) If you already have a remote set and want to change it: ```powershell # View current remote git remote -v # Option A: Update with HTTPS URL git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git # Option B: Update with SSH URL git remote set-url origin git@github.com:YOUR_USERNAME/YOUR_REPO_NAME.git # Verify the change git remote -v ``` --- ## Method 2: Remove and Re-add Remote If you want to completely remove and add a new remote: ```powershell # Remove existing remote git remote remove origin # Add new remote git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git # Verify git remote -v ``` --- ## Method 3: Using Your GitHub Repository ### Step 1: Create Repository on GitHub 1. Go to https://github.com/new 2. Repository name: `RAG-Capstone-Project` 3. Description: `Retrieval-Augmented Generation system with TRACE evaluation` 4. Select Public or Private 5. **IMPORTANT**: Don't initialize with README, .gitignore, or license 6. Click "Create repository" ### Step 2: Copy Your Repository URL After creating, GitHub will show you the URL. Copy it (should look like): ``` https://github.com/YOUR_USERNAME/RAG-Capstone-Project.git ``` ### Step 3: Update Remote in Your Local Repository ```powershell cd "D:\CapStoneProject\RAG Capstone Project" git remote set-url origin https://github.com/YOUR_USERNAME/RAG-Capstone-Project.git # Verify git remote -v ``` --- ## Complete Step-by-Step Example Let's say your GitHub username is `john-doe`: ```powershell # 1. Navigate to project cd "D:\CapStoneProject\RAG Capstone Project" # 2. Update the remote URL git remote set-url origin https://github.com/john-doe/RAG-Capstone-Project.git # 3. Verify it was updated git remote -v # 4. Push to GitHub (first time) git push -u origin main # 5. For future pushes (just use) git push ``` --- ## Using SSH Instead of HTTPS ### Step 1: Generate SSH Key (if you don't have one) ```powershell ssh-keygen -t ed25519 -C "your_email@example.com" ``` ### Step 2: Add SSH Key to GitHub 1. Copy the public key: `cat ~/.ssh/id_ed25519.pub` 2. Go to https://github.com/settings/keys 3. Click "New SSH key" 4. Paste your public key 5. Save ### Step 3: Update Remote to SSH ```powershell git remote set-url origin git@github.com:YOUR_USERNAME/RAG-Capstone-Project.git # Verify git remote -v # Test connection ssh -T git@github.com ``` --- ## Troubleshooting ### Problem: "fatal: remote origin already exists" ```powershell # Remove the old remote first git remote remove origin # Then add the new one git remote add origin https://github.com/YOUR_USERNAME/RAG-Capstone-Project.git ``` ### Problem: "Permission denied (publickey)" This means SSH authentication failed. Use HTTPS instead: ```powershell git remote set-url origin https://github.com/YOUR_USERNAME/RAG-Capstone-Project.git ``` ### Problem: "fatal: Authentication failed" This means your GitHub credentials are incorrect. Use a Personal Access Token: 1. Generate token: https://github.com/settings/tokens 2. When pushing, use the token as password ### Check Current Configuration ```powershell # View remote URLs git remote -v # View detailed remote info git remote show origin # View git config git config --local -l ``` --- ## Quick Reference | Task | Command | |------|---------| | View remotes | `git remote -v` | | Update URL (HTTPS) | `git remote set-url origin https://github.com/USER/REPO.git` | | Update URL (SSH) | `git remote set-url origin git@github.com:USER/REPO.git` | | Remove remote | `git remote remove origin` | | Add remote | `git remote add origin ` | | Push to remote | `git push -u origin main` | | Check remote details | `git remote show origin` | --- ## What You Need to Push Before pushing, make sure you have: - ✅ GitHub account created - ✅ Repository created on GitHub - ✅ Remote URL updated correctly - ✅ Local commits ready (already done ✓) --- **What's your GitHub username?** I can help you with the exact commands once you provide it!