Skip to content
Discussion options

You must be logged in to vote

You can push your existing local files to a GitHub repository and replace its contents, but the exact steps depend on whether you want to overwrite history or just update files.


Case 1: Push local files and overwrite remote (most common)

If you already have files on your computer:

# Go to your project folder
cd your-project

# Initialize git (if not already)
git init

# Add remote repository
git remote add origin https://github.com/your-username/your-repo.git

# Add all files
git add .

# Commit
git commit -m "Initial commit"

# Force push (overwrites remote content)
git push -f origin main

NOTE: This will replace everything on the remote repository.


Case 2: Replace old repo with new co…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by legend-ron2025
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question Ask and answer questions about GitHub features and usage ARC (Actions Runner Controller) For issues and discussions related to the Actions Runner Controller project Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates
6 participants