DEV Community

Sandip Basnet
Sandip Basnet

Posted on • Edited on

1

Easy way of adding an existing project to github using CLI.

If you have existing projects or files already and want to push/publish it on github repo, but not familiar with the git commands for it then following steps will make you complete your task within a minutes.

Step 1:- First of all visit your github dashboard and then create a repo either private or public but don’t initiate with README and any License Templates,and then click create new repository button, after that you will be redirected to Quick Set up Page, now copy the project URL with HTTPS option.

Step 2:- Open Terminal and then change the directory to your working or project Directory.

Step 3:- Initialize your local project as a Git Repository with
$git init .

Step 4:- Add the file to a repository with $git add . , This adds the files of your local repository to staging for your initial commit.

Step 5:- Commit the files that you have added or staged in your local repository with $git commit -m “your commit message”.

Step 6:- Now add the URL of your remote repository that you have copied from Quick Setup Page with $git remote add origin < your remote repository URL> and then verify it with $git remote -v .

Step 7:- Now Push your staged files to remote repository with $git push origin master

After that, you will be asked for Github username and password please provide those credentials, as soon as you enter your password, your local project starts pushing to Github.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay