
We can set up connections with the remote repositories and can push or pull from these. Shortnames are short, easy-to-remember names that make. Following is the syntax to add an online repository to the existing git remote. The basic command to add a remote repository is: git remote add shortname url. It is common to use upstream as the nickname for this remote. Click on + icon located on top right corner to create a new remote git repo as shown in image below: Click on New Repository menu. In Git terminology, a remote is short for a remote repository. Git Remote is used to manage list of online repositories being tracked by you. It makes your setup easier for others to understand and for you to transfer information that you read in documentation, on Stack Overflow, or in blogs.Ī common reason to add a second remote is when you have done a “fork and clone” of a repo and your personal copy (your fork) is set up as the origin remote.Įventually you will want to pull changes from the original repository. It is tempting to use a more descriptive nickname (such as github), but you might find that following convention is worth it. Sidebar on nicknames: there is a strong convention to use origin as the nickname of your main remote.Īt this point, it is common for the main remote of a repo to be hosted on GitHub (or GitLab or Bitbucket). Enter the following commands: Shell git init git add git commit -a -m Initial commit git remote add origin git. Note: when you add a remote you give it a nickname (here happygit), which you can use in git commands in place of the entire URL. Also, we can explicitly add a remote for a repository. Then use this command to update / replace.


Use git remote add to add a new remote: git remote add happygit When we fetch a repository implicitly, git adds a remote for the repository. But if you have already add push / fetch git url, you can follow this steps. However, after the initial clone, it is often useful to add additional remotes. Git clone automatically adds a new remote, so often you do not need to do
