%% date:: [[2023-04-01]], [[2023-07-19]] %% # [[Pushing a local repo to GitHub]] Here's how to create a [[Git]] repository from scratch and push it to [[GitHub]]. ## Initialize a Git repository From the directory that you want to turn into a Git repository, run `git init`. ## Make changes Make the changes in the repository that you'd like to track. ## Stage the changes `git add .` ## Commit the changes `git commit -m 'Nice message here to say what you changed'` Bundle the staged changes into a single change to prepare to synchronize your local copy to the remote copy on GitHub. ## Create the repository on GitHub Sign into your account on GitHub and create a repository with the same name as your local repo. ## Set the remote repo that you'll want to push to Tell your local repo which repo is "upstream" and where that remote repo is on GitHub. `git remote add origin git@github-NVDH:nicolevanderhoeven/reponame.git` ## Push your local changes to GitHub `git push -u origin main`