Skip to content

Instantly share code, notes, and snippets.

@abykal
Forked from alexpchin/Add_Existing_Project_To_Git.md
Last active December 15, 2022 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abykal/cd2564620f4d9e5c1dcf5844211bab4a to your computer and use it in GitHub Desktop.
Save abykal/cd2564620f4d9e5c1dcf5844211bab4a to your computer and use it in GitHub Desktop.
Add Existing Project To Git Repo

#Adding an existing project to GitHub using the command line

Simple steps to add existing project to Github.

1. Create a new repository on GitHub.

In Terminal, change the current working directory to your local project.

##2. 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 .

or:

git add --all

Commit the files that you've staged in your local repository.

git commit -m 'First commit'

Copy remote repository URL field from your GitHub repository, in the right sidebar, copy the remote repository URL.

In Terminal, add the URL for the remote repository where your local repostory will be pushed.

git remote add origin <remote repository URL>

Sets the new remote:

git remote -v

Push the changes in your local repository to GitHub.

git push origin main

Pushes the changes in your local repository up to the remote repository you specified as the origin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment