How to Push a Project to GitHub?

Create a GitHub repository

Open your project folder in terminal

Initialize Git if needed: `git init`

Add files: `git add .`

Commit changes: `git commit -m “Initial commit”`

Add the remote repository: `git remote add origin `

Check the remote: `git remote -v`

Push to GitHub: `git push -u origin main`

If your branch is `master`, use: `git push -u origin master`

If needed, rename the branch to `main`: `git branch -M main`

Enter your GitHub credentials or token if prompted

Suggested for You

Trending Today