Introduction to Uploading a New Project to GitHub

When you create a new project on the GitHub web interface without selecting options such as README, LICENSE, or .gitignore, GitHub shows several initialization commands. This article reviews what those methods are.

How to Upload a New Project to GitHub

GitHub suggests three methods in total. Let’s look at each one.

Quick setup - if you have done this kind of thing before

The first option tells you to clone and configure the repository.

Quick setup — if you’ve done this kind of thing before

[Set up in Desktop] or [HTTPS|SSH] git@github.com:devkuma/project-tutorial.git

Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

Looking at the message, GitHub tells you to create a new file or upload an existing file. It also includes a helpful note recommending that every repository include a README, LICENSE, and .gitignore.

…or create a new repository on the command line

The second option shows how to create a new repository with commands and upload it to GitHub.

…or create a new repository on the command line

echo "# project-tutorial" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:devkuma/project-tutorial.git
git push -u origin main

These commands create a README, set the main branch name to main, add the remote URL, and push to the main branch.

…or push an existing repository from the command line

The last option shows how to upload a project that is already managed with Git to GitHub.

…or push an existing repository from the command line

git remote add origin git@github.com:devkuma/project-tutorial.git
git branch -M main
git push -u origin main

These commands add the remote URL, set the main branch name to main, and push to the main branch.

Conclusion

Any method is fine; choosing one is mostly a matter of preference.
However, as described at the top, it is better for maintenance to include a README, LICENSE, and .gitignore, so adding them is recommended.