logo
. . .

How to Push an Existing Project to GitHub

To Push an Existing Project to GitHub, follow these Steps:

1. Create a GitHub Repository:
How to Create Account and Repository on Github

Log in to your GitHub account.

Click on the “+” icon in the top-right corner and select “New repository”.

Name your repository, choose public or private, add a description, and adjust settings.

Click “Create repository”.

2.Navigate to Your Project Directory:

Open your terminal or command prompt.

Use the cd command to go to your project directory.

3.Initialize Git:

If not already using Git, initialize a Git repository in your project directory:
git init

4.Add Your GitHub Repository as a Remote:

Link your local repository to the GitHub repository you created:
git remote add origin https://github.com//.git

5.Add Your Files to the Staging Area:

Use git add to add files to the staging area.

6.Commit Your Changes:

Commit changes with a descriptive message:
git commit -m “Initial commit”

7.Push Your Changes to GitHub:

Push commits to the main branch of the GitHub repository:
git push -u origin main

8.Enter Your GitHub Credentials:

If prompted, enter your GitHub username and password or access token.

9.Verify on GitHub:

Refresh your GitHub repository page to see your project files and commits.

Your existing project is now on GitHub. Use git push to send updates to the remote repository.