Setup Guides

Uploading a Project to GitHub: Step by Step

We walk you through creating a new GitHub repository, connecting your local project, making the first commit and push, and the GitHub Desktop and gh CLI alternatives.

Aurora YazılımEditorial team 6 min read
Uploading a Project to GitHub: Step by Step
How do you upload a project to GitHub?

To upload a project to GitHub, first create an empty repository on github.com. In your project folder, record the first snapshot with git init, git add . and git commit, connect the repository with git remote add origin, then send it with git push -u origin main. GitHub Desktop or the gh repo create command does the same job without the command line.

What You Need Before You Start

Uploading a project to GitHub means turning a folder on your computer into a Git repository and linking it to a remote repository online. Three things must be ready: Git installed and configured, a GitHub account and an authentication method.

If you have not installed Git yet, or have not set your name, email and SSH key, start with our Git installation guide. The commands in this post assume those settings are done.

  • Git: Running git --version in the terminal should return a version number.
  • GitHub account: You can open one for free at github.com.
  • Authentication: An SSH key, or for HTTPS, Git Credential Manager or a personal access token. GitHub does not accept your account password for Git operations.
  • A clean project folder: A .gitignore file to filter out unnecessary and secret files.

Creating a Repo on GitHub

Sign in to GitHub, click the plus icon at the top right and choose New repository. Use a short, lowercase repository name (for example company-site), add a description and choose the visibility.

If you already have a project on your computer, do not add a README, .gitignore or license; create the repository completely empty. Otherwise the remote repository gets a commit that does not exist locally, and your first push runs into a conflict.

VisibilityWho can see itWhen to choose it
PublicEveryoneOpen-source projects, portfolio work
PrivateOnly you and the people you inviteClient projects, internal company code

Filter Out Unwanted Files with .gitignore

The most important job before your first commit is deciding which files must stay out of the repository. node_modules, build folders, operating system files and above all .env files containing passwords or API keys must never be uploaded to GitHub.

Create a file named .gitignore in the project root and add lines like the ones below. We explain why dependencies stay out of the repository, and the role of package.json, in our npm commands post.

  • If you committed a secret file by mistake, deleting it later is not enough; the file stays in the history. Change the key or password immediately.
  • To stop tracking a folder that is already tracked, use git rm -r --cached folder-name, then add it to .gitignore and commit.
textExample .gitignore
node_modules/
dist/
build/
.env
.env.*
.DS_Store
Thumbs.db
*.log

First Upload from the Command Line

In the terminal, move into the project folder and run the commands below in order. You will find the remote repository address on the empty repository's page on GitHub, under the Code button; copy the SSH address if you have set up an SSH key, or the HTTPS address if you have not.

  1. Turn the folder into a Git repository with git init.
  2. Stage all files with git add ..
  3. Create the first snapshot with git commit.
  4. Fix the branch name as main.
  5. Connect the remote repository with git remote add origin.
  6. Send it with git push -u origin main; the -u flag lets you type just git push next time.
bashFirst upload
cd proje-klasoru
git init
git add .
git commit -m "First commit"
git branch -M main

# SSH adresi
git remote add origin git@github.com:kullanici-adi/depo-adi.git
# ya da HTTPS adresi
# git remote add origin https://github.com/kullanici-adi/depo-adi.git

git push -u origin main
bashChecking the connection
git remote -v
git status
git log --oneline

Uploading with GitHub Desktop and the gh CLI

The command line is not the only way. GitHub Desktop suits those who prefer a visual interface, and gh, GitHub's official command-line tool, suits those who want to work faster in the terminal; both do the same job in a few steps.

GitHub Desktop

Install GitHub Desktop and sign in with your account. From the File menu, choose Add local repository and select your project folder; if the folder is not a repository yet, the app offers to create one. You see your changes in the left panel, type a message in the box at the bottom and press Commit. Finally, the Publish repository button creates the repository on GitHub and pushes it.

gh CLI

With gh, creating, connecting and pushing the repository combine into a single command. On first use you sign in through the browser with gh auth login.

bashCreating a repo and pushing with gh
gh auth login

# When the folder has at least one commit
gh repo create depo-adi --private --source=. --remote=origin --push

With VS Code

The Publish to GitHub button in VS Code's source control panel offers the same flow. For editor setup and Git integration, see our VS Code installation guide.

How Do I Push Updates?

After the first upload, the daily routine is just three commands: stage the changes, save them, send them. If you work on another computer, or a teammate made changes, pull the latest version with git pull before you start.

Write short, meaningful commit messages: something like “added phone field to the contact form” instead of “update”. Six months from now, these messages tell you what changed and why.

bashDaily workflow
git pull
git add .
git commit -m "Add phone field to contact form"
git push

Working with branches

Instead of making a big change directly on the main branch, open a new branch: git switch -c new-feature. Push it with git push -u origin new-feature and open a pull request on GitHub. The change is reviewed before it is merged, and the main branch always stays in a working state.

Common Push Errors and Fixes

Most errors in the first push attempts come down to authentication, the branch name, or unexpected commits on the remote repository.

  • src refspec main does not match any: There is no commit yet, or your branch is named master. Make a commit with git commit, or rename the branch with git branch -M main.
  • remote origin already exists: The remote is already defined. To change the address, use git remote set-url origin new-address.
  • rejected (fetch first / non-fast-forward): The remote has a commit you do not have locally, usually a README created on GitHub. Fetch it with git pull --rebase origin main and push again. If the histories are completely unrelated, you may need git pull origin main --allow-unrelated-histories.
  • Permission denied (publickey): Your SSH key has not been added to your account; test it with ssh -T git@github.com.
  • Large file error: GitHub rejects single files over 100 MB. Remove videos and backups from the repository or use Git LFS.

What Does GitHub Add to Business Projects?

Keeping your code on GitHub means the project is not lost if a computer fails or goes missing. More importantly, because every change is traceable, when a bug reaches the live site you can quickly find which commit caused it and roll it back.

When speed and performance improvements on a website, such as image compression and code minification, are saved as separate commits, it becomes easy to measure how much each one changed. We work with this discipline in our corporate website and web design projects.

Do not forget to add a well-written README file to the repository. A few paragraphs explaining what the project does, how it is installed and which command runs it save a new team member, or you coming back months later, hours of work. List environment variables by name only, never with their values.

For more step-by-step guides, browse the setup guides category.

Frequently Asked Questions

01Does uploading a project to GitHub cost money?

No. On GitHub's free plan you can create unlimited public and private repositories. Paid plans are chosen mostly for needs such as team management, advanced security and extra automation minutes.

02Can I upload a project by drag and drop?

You can upload files in GitHub's web interface with Add file > Upload files. However, this method is limited in file count and size and is not practical for regular updates; using Git or GitHub Desktop is much easier in the long run.

03I uploaded a file containing a password by mistake. What should I do?

First change that password or API key right away; deleting the file does not remove the copy in the history. Then add the file to .gitignore and, if needed, follow GitHub's guide on removing sensitive data to clean the history.

Uploading a project to GitHub takes minutes with an empty repository, a clean .gitignore and a few Git commands, and after that every change is safely recorded. If you are planning a custom software or web project for your business that is built with version control, explore Aurora Yazılım's custom software solutions or get in touch.