How to add a remote repository in git

Written by Michael Lee on April 21, 2016

Perhaps you’ve already got a project folder, and initiated git on the project with git init. And let’s say you have an existing remote git repository for your project that you would like to use version your project. You can add the remote repository by using the git remote add command.

The remote add command takes two arguments. The first is a remote name, such as origin and the second argument is a URL for the remote repository. Putting it altogether, the command looks like this:

# This sets a new remote to the current git repo
git remote add origin

Once you set a new remote repository, you can verify that the remote was added correctly by running:

git remote -v
# This should yield something like this:
origin (fetch)
origin (push)
Thanks for taking the time to read this article. I'd love to stay in touch and share more tips on programming and design, side projects and working remotely. Sign up and I'll send you my articles straight to your email.

:wave: Hey hey, I'm Michael Lee! I really appreciate you taking the time to read this article.

Be sure to check out my other articles.