What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
To put an existing project folder on GitHub, create a local Git repository, commit the files you want to keep, create an empty GitHub repository, then connect the two and push your branch. You can do that with Git commands, GitHub CLI, or GitHub Desktop. The steps below are for a folder on your computer that is not already connected to the GitHub repository you intend to use.
Choose the right route before you start
Git is the version-control tool that tracks changes on your computer; GitHub hosts a remote copy of a repository. Initializing a folder locally and creating a repository on GitHub are separate actions. A local commit records a snapshot on your computer; it does not upload the files. Uploading happens when you push a branch.
As an Amazon Associate I earn from qualifying purchases.
- Use direct Git commands if you want to see and learn each setup step.
- Use GitHub CLI if you are comfortable in a terminal but want prompts to help create the remote and publish.
- Use GitHub Desktop if you prefer a graphical interface for publishing an existing project.
If the project already exists on GitHub and you want a working copy on your computer, use git clone instead. Cloning copies a remote project locally; it is different from initializing an existing local folder and pushing it.
Free tools Windows power users keep installed
One-click scans. No signup required.
Prepare the local folder and files
Open a terminal in the project’s root folder—the directory containing the files you intend to track. Before staging anything, inspect its contents. Do not include passwords, API keys, or other secrets in a repository. Keep sensitive configuration outside the project or exclude it as appropriate.
#1 Best Overall
Check whether the folder already contains a .git directory. If it does, it is already a Git repository: do not blindly initialize it or overwrite its configuration. Review its current branch and remotes first. The commands below assume the folder is not already a Git repository.
Initialize Git and make the first commit
For Git 2.28.0 and later, GitHub documents initializing a new repository with the branch named main like this:
Rank #2
git init -b main
That option is not universal to older Git versions. If your installation is Git 2.27.1 or earlier, use GitHub’s version-appropriate branch-setting procedure rather than assuming -b will work.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Stage the files you want included and create the first local snapshot:
git add .
git commit -m "First commit"
git add . stages changes under the current directory, so inspect the folder first and make sure secrets or generated files are not included. Staging selects content for the next snapshot; committing records that snapshot locally. Neither command uploads it.
Create an empty GitHub repository
On GitHub, create a new repository under the personal account or organization where it belongs, provided you have permission to create repositories there. For this existing-local-history workflow, leave the options to add a README, license, or .gitignore unchecked. Starting the remote with its own commit can make it unrelated to the local history and lead to a merge conflict when you try to push.
Rank #4
Authenticate, connect the remote, and push
GitHub requires command-line authentication before you add a local repository using Git. Configure authentication for your environment using GitHub’s current authentication instructions; do not assume a password prompt or SSH setup is already in place.
- Copy the repository URL. On the new repository’s Quick Setup page, copy its remote URL.
- Add the remote. In the project root, replace
REMOTE-URLwith the copied URL:git remote add origin REMOTE-URL - Verify the remote.
git remote -vYou should see the GitHub repository URL for the
originremote. - Push your current branch. If it is named
main, run:git push -u origin mainIf your branch has another name, substitute that name for
main. The-uoption sets the upstream relationship for the branch, making later pushes simpler.
GitHub’s instructions for adding locally hosted code cover the command-line setup and push flow.
Best Value
Publish with GitHub CLI or GitHub Desktop instead
These are alternative publication routes; choose one rather than mixing its setup steps with the manual remote procedure above.
GitHub CLI
GitHub CLI can create a repository from an existing local repository, add the remote, and push through guided prompts. Follow GitHub’s local-code instructions for the CLI route.
GitHub Desktop
GitHub Desktop provides a graphical workflow for publishing an existing project. Use GitHub’s procedure for adding an existing project if you prefer point-and-click controls.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteQuick Recap
Fix common first-push problems
- The push is rejected because the remote already has a commit: Check whether you created the GitHub repository with a README, license, or
.gitignore. The straightforward local-history flow uses an empty remote. Do not overwrite or force-push without first understanding what is already on the remote. - The command reports that the branch does not exist: Your local branch may not be named
main. Check the current branch and use its actual name ingit push -u origin BRANCH-NAME. - The remote command shows the wrong repository: Review the output of
git remote -vand ensure the URL is the intended repository before pushing. - A secret was staged but not committed: Remove it from the staged changes before committing, then ensure it is excluded as appropriate. If a secret has already been committed or pushed, removing the file in a later commit does not erase it from repository history; revoke or rotate the exposed credential.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




