• Git-第四篇廖雪峰Git教程学习笔记(3)远程仓库,克隆远端库


    1、本次连接的是gitHub仓库。

      1》创建SSH Key。

    ssh-keygen -t rsa -C "youremail@example.com"
    lfy@lfy-PC MINGW64 /c/fyliu/lfyTemp/gitLocalRepository/yangjie (master)
    $ ssh-keygen -t rsa -C "12345678@qq.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/lfy/.ssh/id_rsa):
    Created directory '/c/Users/lfy/.ssh'.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /c/Users/lfy/.ssh/id_rsa.
    Your public key has been saved in /c/Users/lfy/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:88888888888888888jY888888888I8 12345678@qq.com
    The key's randomart image is:
    +---[RSA 2048]----+
    |   .......       |
    |                 |
    +----[SHA256]-----+
    
    lfy@lfy-PC MINGW64 /c/fyliu/lfyTemp/gitLocalRepository/yangjie (master)
    $

      2》将公钥添加到ssh key列表。

      3》在gitHub上创建一个新的库,然后使用命令将我们的本地库与之关联。

    $ git remote add origin git@github.com:michaelliao/learngit.git

       添加后,远程库的名字就是origin,这是Git默认的叫法,也可以改成别的,但是origin这个名字一看就知道是远程库。

      4》将已经与远端库关联的本地库的内容推送到远端库。

    $ git push -u origin master

       本地库的内容推送到远程,用git push命令,实际上是把当前分支master推送到远程。由于远程库是空的,我们第一次推送master分支时,加上了-u参数,Git不但会把本地的master分支内容推送的远程新的master分支,还会把本地的master分支和远程的master分支关联起来,在以后的推送或者拉取时就可以简化命令。

    2、克隆远端库

    $ git clone git@github.com:michaelliao/gitskills.git
    Cloning into 'gitskills'...
    remote: Counting objects: 3, done.
    remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3
    Receiving objects: 100% (3/3), done.
  • 相关阅读:
    对象引用与对象克隆
    谁被回收了
    SpringMVC 返回json
    html基础
    org.hibernate.HibernateException: No Session found for current thread
    VB6之SendMessage模拟拖放事件
    VB6之GIF分解
    VB6之反编译工具VBRezQ
    VB6之WebBrowser控件
    (转载)VB6之鼠标移出事件
  • 原文地址:https://www.cnblogs.com/ZeroMZ/p/11406421.html
Copyright © 2020-2023  润新知