iOS Development Environment-git Tutorial 2.0: adding a remote repository

Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-size: 15px"><strong><span style="font-family: 黑体; color: #ff0000">To add a remote library</span></strong></span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">1-after you have created a git repository locally, you want to create a git repository on GitHub and synchronize the two warehouses remotely, so that the repository on GitHub can be used as a backup and other people to collaborate through the Warehouse.</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">2-start adding</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">(1) first, Log on to GitHub and then, in the upper right corner, find the "create<span style="font-family: 黑体; font-size: 14px">a new repo</span>" button to create a new warehouse:</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px"></span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">(2) in Repository name fill in <code>learngFirstGit</code> , the other remains the default settings, click the "<span style="font-family: 黑体; font-size: 14px">Create Repository</span>" button, The successful creation of a new git repository:</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px"></span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">(3) at the moment, this <span style="font-family: 黑体; font-size: 14px"> <code>learngFirstGit </code> </span> warehouse on GitHub is still empty, and GitHub tells us that we can clone a new repository from this repository, or associate an existing local repository with it, and then push the contents of the local repository to the GitHub repository</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px"></span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">(4) now, on GitHub's tip, we run the <code>markGit</code> command under the local repository: please be careful to replace the following with <code>Beisongshi </code> your own github account name, otherwise, you are locally associated with my remote library! however, you will find that the link after you push is not pushed up, because your SSH key public key is not in my account List. After adding, the name of the remote library is <code>origin</code> , this is the default for Git, or can be changed to another, but <code>origin </code> this name is known as a remote Library.</span></p></p><pre><pre><span style="color: #008080">1</span> $ git Remote add Origin [email Protected]:beisongshi/learngfirstgit.git</pre></pre><p><p><span style="font-family: 黑体; font-size: 14px">(5) next, You can push all the contents of the local library to the remote library</span></p></p><pre><pre><span style="color: #008080">1</span> $ git push-<span style="color: #000000">u Origin master</span><span style="color: #008080">2</span><span style="color: #800000">'</span><span style="color: #800000">github.com (192.30.255.113)</span><span style="color: #800000">'</span> can <span style="color: #800000">'</span> <span style="color: #800000">t be established.</span> <span style="color: #008080">3</span> <span style="color: #0000ff"></span> is <span style="color: #000000">sha256:nthbg6kxupjwgl7e1igocspromtxdcarlvikw6e5sy8.</span> <span style="color: #008080">4</span> <span style="color: #0000ff">Continue</span></pre></pre><p><p><span style="font-family: 黑体; font-size: 14px">yes, There's a warning! Don't ask me why, because I don't know. Command line yes to continue the connection, good luck! The following is the output of the successful connection</span></p></p><pre><span style="color: #008080"><span style="color: #008080">1</span></span>$ git push-<span style="color: #000000"><span style="color: #000000">u Origin Master</span></span><span style="color: #008080"><span style="color: #008080">2</span></span>The authenticity of host<span style="color: #800000"><span style="color: #800000">'</span></span><span style="color: #800000"><span style="color: #800000">github.com (192.30.255.113)</span></span><span style="color: #800000"><span style="color: #800000">'</span></span>Can<span style="color: #800000"><span style="color: #800000">'</span></span><span style="color: #800000"><span style="color: #800000">t be established.</span></span><span style="color: #008080"><span style="color: #008080">3</span></span>RSA Key Fingerprint<span style="color: #0000ff"><span style="color: #0000ff"></span> is</span><span style="color: #000000"><span style="color: #000000">sha256:nthbg6kxupjwgl7e1igocspromtxdcarlvikw6e5sy8.</span></span><span style="color: #008080"><span style="color: #008080">4</span></span>Is you sure-want to<span style="color: #0000ff"><span style="color: #0000ff">Continue</span></span>Connecting (yes/no)?<span style="color: #000000"><span style="color: #000000">Yes</span></span><span style="color: #008080"><span style="color: #008080">5</span></span>Warning:permanently added<span style="color: #800000"><span style="color: #800000">'</span></span><span style="color: #800000"><span style="color: #800000">github.com,192.30.255.113</span></span><span style="color: #800000"><span style="color: #800000">'</span></span><span style="color: #000000"><span style="color: #000000">(RSA) to the list of known Hosts.</span></span><span style="color: #008080"><span style="color: #008080">6</span></span>Counting objects:<span style="color: #800080"><span style="color: #800080"></span> -</span><span style="color: #000000"><span style="color: #000000">, Done.</span></span><span style="color: #008080"><span style="color: #008080">7</span></span>Delta compression<span style="color: #0000ff"><span style="color: #0000ff">using</span></span>Up to<span style="color: #800080"><span style="color: #800080">4</span></span><span style="color: #000000"><span style="color: #000000">threads.</span></span><span style="color: #008080"><span style="color: #008080">8</span></span>Compressing objects:<span style="color: #800080"><span style="color: #800080"></span> -</span>% (<span style="color: #800080"><span style="color: #800080"></span> -</span>/<span style="color: #800080"><span style="color: #800080"></span> -</span><span style="color: #000000"><span style="color: #000000">), done.</span></span><span style="color: #008080"><span style="color: #008080">9</span></span>Writing objects:<span style="color: #800080"><span style="color: #800080"></span> -</span>% (<span style="color: #800080"><span style="color: #800080"></span> -</span>/<span style="color: #800080"><span style="color: #800080"></span> -</span>),<span style="color: #800080"><span style="color: #800080">2.94</span></span>KiB |<span style="color: #800080"><span style="color: #800080">0</span></span>bytes/<span style="color: #000000"><span style="color: #000000">s, Done.</span></span><span style="color: #008080"><span style="color: #008080">Ten</span></span>Total<span style="color: #800080"><span style="color: #800080"></span> -</span>(delta<span style="color: #800080"><span style="color: #800080">Ten</span></span>), reused<span style="color: #800080"><span style="color: #800080">0</span></span>(delta<span style="color: #800080"><span style="color: #800080">0</span></span><span style="color: #000000"><span style="color: #000000">)</span></span><span style="color: #008080"><span style="color: #008080"></span> one</span>Remote:resolving deltas:<span style="color: #800080"><span style="color: #800080"></span> -</span>% (<span style="color: #800080"><span style="color: #800080">Ten</span></span>/<span style="color: #800080"><span style="color: #800080">Ten</span></span><span style="color: #000000"><span style="color: #000000">), done.</span></span><span style="color: #008080"><span style="color: #008080"></span> a</span>To github.com:beisongshi/<span style="color: #000000"><span style="color: #000000">Learngfirstgit.git</span></span><span style="color: #008080"><span style="color: #008080"></span> -</span>* [<span style="color: #0000ff"><span style="color: #0000ff">New</span></span>branch] master,<span style="color: #000000"><span style="color: #000000">Master</span></span><span style="color: #008080"><span style="color: #008080"></span> -</span>Branch Master<span style="color: #0000ff"><span style="color: #0000ff">Set</span></span>Up-to-track Remote Branch master from Origin.</pre><p><p><span style="font-family: 黑体; font-size: 14px">Pushing the contents of the local library to the remote, with <code>git push </code> the command, is actually pushing the current branch <code>master </code> to the Remote.</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">Since the remote library is empty, the first time we push <code>master </code> a branch, with <code>-u</code> parameters, Git will not only <code>master </code> push the local branch content of the remote new <code>master </code> branch, but also the local <code>master </code> branch and the remote <code>master </code> branch association, You can simplify the command at a later push or Pull.</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">(6) after a successful push, you can immediately see the remote Library's contents on the GitHub page as if it were local:</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px"></span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">(7) congratulations, from now on, as long as the local submission, you can through the Command:</span></p></p><pre><pre><span style="color: #008080">1</span> $ Git push origin master</pre></pre><p><p>Push the <code>master </code> latest changes from your local branch to GitHub, and now you have a truly distributed repository!</p></p><p><p><span style="color: #ff0000"><strong><span style="font-family: 黑体; font-size: 15px">SSH warning</span></strong></span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">1-when you first use git <code>clone</code> or <code>push</code> a command to connect to github, you get a warning:</span></p></p><pre><pre><span style="color: #008080">1</span> <span style="color: #800000">'</span> <span style="color: #800000">github.com (xx.xx.xx.xx)</span> <span style="color: #800000">'</span> can<span style="color: #800000">'</span><span style="color: #800000">t be established.</span> <span style="color: #008080">2</span> <span style="color: #0000ff"></span> is <span style="color: #000000">xx.xx.xx.xx.xx.</span> <span style="color: #008080">3</span> <span style="color: #0000ff">Continue</span> connecting (yes/no)?</pre></pre><pre><pre><code class="undefined"></code></pre></pre><p><p><span style="font-family: 黑体; font-size: 14px">(1) This is because Git uses SSH connection, and S SH connection is the first time to verify the GitHub server key, you need to confirm that the GitHub key fingerprint information is really from the GitHub server, enter the <code>yes </code> return.</span></p></p><p><p><span style="font-family: 黑体; font-size: 14px">2-at this point, Git will output a warning telling you that you have added GitHub key to a trust list on this machine:</span></p></p><pre><pre><span style="color: #008080">1</span> <span style="color: #800000">'</span> <span style="color: #800000">github.com</span> <span style="color: #800000">'</span> (RSA) to the list of known Hosts.</pre></pre><p><p><span style="font-family: 黑体; font-size: 14px"> <span style="background-color: #ff6600">note:</span> This warning will only appear once, and there will be no warning after the Operation. </span>If You're really worried about someone impersonating a github server, you <code>yes</code> can check the fingerprint information of Github's RSA key before entering it with the same SSH Connection.</p></p><p><p><span style="font-family: 黑体; font-size: 14px">One of the biggest benefits of the fabric version system is that working locally does not have to take into account the existence of remote libraries, which means that there is no internet connection that works, and SVN refuses to work when it is not connected! And git when there is a network, and then the local submission push a bit to complete the synchronization, it is too nb!</span></p></p><p><p> iOS Development Environment-git Tutorial 2.0: Adding a remote repository </p> </p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.