This guide addresses common issues when creating release tags from VS Code terminal.
If you're in VS Code and want to tag a release, use the automated script:
./scripts/create_release_tag.sh v0.1.0 "Release v0.1.0 - Initial stable release"This handles all the edge cases automatically.
Error:
No local changes to save
Why it happens:
- Your working directory is already clean
git stashonly works when there are uncommitted changes- This is actually a good thing - you're ready to tag!
Solution:
# Check if you have changes first
git status -s
# Only stash if the output is not empty
if [[ -n $(git status -s) ]]; then
git stash push -u -m "pre-tag cleanup"
else
echo "No changes to stash - proceeding to tag"
fi
# Or just skip stashing if working tree is cleanError:
fatal: couldn't find remote ref main
# or
Authentication failed
Why it happens:
- Branch doesn't exist: The
mainbranch might not exist locally or remotely - Authentication: VS Code needs credentials configured for HTTPS, or SSH keys for SSH URLs
- Detached HEAD: You might be on a specific commit, not a branch
Solutions:
# See all branches
git branch -a
# Check current branch/commit
git branch --show-current
git log --oneline -1If you're on a feature branch like copilot/cleanup-and-tag-phase-5, you can tag directly:
# You don't need to switch to main
# Just tag where you are
git tag -a v0.1.0 -m "Release v0.1.0"
git push origin v0.1.0For HTTPS (requires token or credentials):
# Check remote URL
git remote -v
# If using HTTPS, you may need to configure credentials
# In VS Code, this is usually handled by the Git extension
# Make sure you're signed into GitHub in VS CodeFor SSH (requires SSH keys):
# Check if SSH keys are set up
ssh -T git@github.com
# If not, switch remote to SSH
git remote set-url origin git@github.com:SynTechRev/SynTechRev-PolyCodCal.gitProblem: This command removes ALL untracked files, including:
- Local configuration files
- IDE settings you want to keep
- Downloaded data files
- Anything not in
.gitignoreand not committed
Solution: Use the safer cleanup script instead:
# Safe cleanup - only removes build artifacts
./scripts/cleanup_repo.shOr clean specific types manually:
# Python cache only
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
# Test artifacts only
rm -rf .pytest_cache htmlcov .coverage
# Linter cache only
rm -rf .mypy_cache .ruff_cacheError:
fatal: Unable to create '.git/index.lock': File exists
Why it happens:
- A previous git operation was interrupted
- Another git process is running
- VS Code Git extension might be refreshing
Solution:
# Make sure no git operations are running
ps aux | grep git
# Remove the lock file (ONLY if no git processes are running!)
rm -f .git/index.lock
# Now try your git command again# 1. Open integrated terminal in VS Code (Ctrl+`)
cd /home/runner/work/SynTechRev-PolyCodCal/SynTechRev-PolyCodCal
# 2. Run the tag script
./scripts/create_release_tag.sh v0.1.0 "Release v0.1.0"
# 3. Follow the prompts
# - Script checks for issues
# - Cleans artifacts
# - Creates tag
# - Offers to push# 1. Check current state
git status
git log --oneline -5
# 2. Clean artifacts (safe)
./scripts/cleanup_repo.sh
# 3. Create tag
git tag -a v0.1.0 -m "Release v0.1.0
- Comprehensive documentation
- Code repair strategy
- VS Code integration
- 100% test coverage
"
# 4. Verify tag
git tag -l
git show v0.1.0
# 5. Push tag
git push origin v0.1.0-
Create Tag:
- Click Source Control icon (Ctrl+Shift+G)
- Click "..." menu → "Tags" → "Create Tag"
- Enter tag name:
v0.1.0 - Enter message
- Note: VS Code creates lightweight tags by default, use terminal for annotated tags
-
Push Tag:
- After creating tag via Source Control
- Open terminal and run:
git push origin v0.1.0 - Or use Command Palette (Ctrl+Shift+P) → "Git: Push Tags"
-
View Tags:
- Source Control "..." menu → "Tags" → "View Tags"
VS Code uses different authentication methods:
-
GitHub Authentication:
- Click Account icon (bottom left)
- Sign in with GitHub
- Grants access to repos
-
Git Credential Manager:
- Handles HTTPS authentication
- Prompts when needed
- Stores credentials securely
-
SSH Keys:
- VS Code uses your system SSH keys
- Set up SSH keys: GitHub SSH docs
Before tagging, verify:
- Working directory is clean:
git status - You're on the right commit:
git log -1 - CHANGELOG.md is updated with the version
- All tests pass (if you can run them)
- No
.git/index.lockfile exists - You're authenticated to GitHub in VS Code
- You're in CI/CD environment
- Main branch doesn't exist locally
- You're completing a specific phase of work
- The feature branch IS ready for release
- Main branch exists and is up to date
- Following traditional release workflow
- Multiple features are being released together
For this project: Since you're on copilot/cleanup-and-tag-phase-5 and it represents the state you want to release, it's fine to tag directly from this branch. After tagging, merge the branch to main (or make main point to this commit).
# Step 1: Check where you are
git status
# Output: On branch copilot/cleanup-and-tag-phase-5
# Output: nothing to commit, working tree clean
# ✓ Good - working tree is clean, no need to stash
# Step 2: Check branches
git branch -a
# Output: * copilot/cleanup-and-tag-phase-5
# Note: Main branch doesn't exist locally, that's OK
# Step 3: Clean artifacts
./scripts/cleanup_repo.sh
# ✓ Removes build files safely
# Step 4: Create tag
git tag -a v0.1.0 -m "Release v0.1.0 - Phase 1 complete"
# ✓ Tag created
# Step 5: Verify
git show v0.1.0
# Shows tag details
# Step 6: Push
git push origin v0.1.0
# ✓ Tag pushed to GitHub
# Step 7: Create GitHub Release
# Go to: https://github.com/SynTechRev/SynTechRev-PolyCodCal/releases/new
# Select tag: v0.1.0
# Add release notes from CHANGELOG.md
# Publish!❌ Don't use git clean -xdf without understanding what it removes
❌ Don't force-stash when working tree is clean
❌ Don't delete .git/index.lock while git operations are running
❌ Don't create tags with secrets or credentials in commit history
❌ Don't tag without updating CHANGELOG.md
❌ Don't delete remote tags that others might be using
If you encounter issues:
- Check the full TAGGING_GUIDE.md for detailed explanations
- Run
./scripts/create_release_tag.shfor automated handling - Verify authentication:
git remote -vand sign in to GitHub in VS Code - Check for lock files:
ls -la .git/ | grep lock - Review git status:
git status -vv
The commands that gave you trouble:
# ❌ This fails if working tree is clean (good state!)
git stash push -u -m "pre-tag cleanup before switching to main"
# ❌ This fails if main branch doesn't exist or auth issues
git pull --ff-only
# ❌ This is too aggressive and removes everything untracked
git clean -xdfInstead, use:
# ✅ Simple and works from any branch
./scripts/create_release_tag.sh v0.1.0 "Release v0.1.0"
# Or manually:
./scripts/cleanup_repo.sh # Safe cleanup
git tag -a v0.1.0 -m "Release v0.1.0" # Create tag
git push origin v0.1.0 # Push tagThat's it! No need to switch branches, stash changes, or pull from remote.