![]() It is common to use upstream as the nickname for this remote. gitremotes() reports the configured remotes, similar to git remote. 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. Two helpers are available: usegitremote() sets the remote associated with name to url. ![]() It is tempting to use a more descriptive nickname (such as github), but you might find that following convention is worth it. To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at. 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). 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. Use git remote add to add a new remote: git remote add happygit phd when you use git push origin feature01 its a simple pushing but when use -u git establish a tracking relationship between your local branch and the remote branch. The remote called 'origin' is not special in any way, except that it is the default remote created by Git when you clone an existing repository. git remote add Here, is the name of the remote repository that you want to add, and is the URL of the remote repository.So to wrap that up, you have repo A and clone it. The syntax for using git remote add is as follows. To do that, it looks at the HEAD ref of the remote repo, and creates a local branch with the same name as the remote branch referenced by it. ![]() ![]() However, after the initial clone, it is often useful to add additional remotes. You can have as many remotes as you want, but you can only have one remote named 'origin'. As said in this thread: (emphasis mine) 'git clone' creates only a single local branch. Git clone automatically adds a new remote, so often you do not need to do Enter the following commands: Shell git init git add git commit -a -m Initial commit git remote add origin git. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |