- First, initialize the local directory as a Git repository:
git init
- Add the files in your new local repository. This stages them for the first commit:
git add .
- Commit the files that you’ve staged in your local repository:
git commit -m "First commit"
- At the top of your GitHub repository’s Quick Setup page, click the clipboard icon to copy the remote repository URL.
- In Terminal, add the URL for the remote repository where your local repository will be pushed:
git remote add origin <remote repository URL>
- Verify your URL:
git remote -v
- Now, it’s time to push the changes in your local repository to GitHub:
git push -u origin master
Replace <remote repository URL>
with the URL you copied in step 4. If you’ve done everything correctly, your local folder should now be uploaded as a new GitHub repository.