• Git 远程仓库


    Git 远程仓库

    一、本地连接github

      1.生成ssh key

        在git命令界面,键入如下命令生成 SSH Key 公钥

        ssh-keygen -t rsa -C "github账户"

       查看公钥文件是否生成

        cd ~/.ssh    (公钥文件默认路径:C:Users本地帐户名.sshid_rsa.pub)

        ls                  (此处建议打开id_rsa.pub文件,复制ssh key 公钥)

       打开id_rsa.pub文件复制ssh key公钥

        vim id_rsa.pub

        ggyG              (按esc,输入ggyG)

      2.连接Github

       进入GitHub中个人账户 settings

      进入SSH and GPG keys 进行公钥填写

      选择

      选择NEW SSH Key

    二、本地仓库连接GitHub仓库

      1.建立Github仓库

      步骤一:

      步骤二:

      2.本地仓库连接远程仓库

      首先,在本地工作目录建立一个文件夹,并初始化这个文件夹让其成为仓库

      本地仓库连接github仓库,键入如下命令

        git remote add aname git@github.com:guozeping/git_learn.git

        即 git remote add aname git@github.com:github账户名/github仓库名.git

    三、本地仓库文件上传GitHub仓库

      1.1本地文件add到仓库暂缓区

      1.2仓库暂缓区文件commit到仓库

      1.3本地仓库文件推送到github仓库

    四、远程仓库操作

    命令汇总

    $ git init #把当前目录变成git可以管理的仓库
    $ git add readme.txt #添加一个文件,也可以添加文件夹
    $ git add -A #添加全部文件
    $ git commit -m "some commit" #提交修改
    $ git status #查看是否还有未提交
    $ git log #查看最近日志
    $ git reset --hard HEAD^ #版本回退一个版本
    $ git reset --hard HEAD^^ #版本回退两个版本
    $ git reset --hard HEAD~100 #版本回退多个版本
    $ git remote add origin +地址 #远程仓库的提交(第一次链接)
    $ git push -u origin master #仓库关联
    $ git push #远程仓库的提交(第二次及之后)

      

  • 相关阅读:
    underscore utility
    underscore objects
    underscore functions
    underscore arrays
    underscore collections
    underscore概况
    in操作符
    类数组对象 实参对象arguments
    JAVA和C++的区别
    MySQL学习笔记(转自掘金小册 MySQL是怎样运行的,版权归作者所有!)
  • 原文地址:https://www.cnblogs.com/guozepingboke/p/10816429.html
Copyright © 2020-2023  润新知