Initialize and Upload a Git Project to GitHub (Windows)¶
This guide walks you through creating a new Git repository on your Windows workstation, adding files, and pushing them to GitHub.
Initializing and Publishing Your Project with Git and GitHub¶
Set up a new project directory, initialize it as a Git repository, and publish it to GitHub.
Prerequisites¶
- Git installed (
git --version
to verify) - An active GitHub account
1. Create a Local Repository¶
Create and initialize your project folder:
mkdir my-project
cd my-project
git init
echo "# My Project" > README.md
git add README.md
git commit -m "Initial commit"
2. Create a Remote Repository on GitHub¶
- Log in to GitHub.
- Click New repository.
- Enter a repository name and description.
- Choose public or private, then click Create repository.
- Copy the HTTPS URL (e.g.,
https://github.com/yourusername/my-project.git
).
3. Link Local and Remote Repositories¶
Rename your local branch and add the remote origin:
4. Push Local Commits to GitHub¶
Push your commits and set the upstream reference:
Visit your GitHub repo page to confirm your README and initial commit.
5. Next Steps¶
- Add a
.gitignore
file to exclude unnecessary files. - Create feature branches:
- Use pull requests to review and merge changes.
- Tag releases: