zoukankan      html  css  js  c++  java
  • git与github关联

      git与github是什么,网上有很多资料我就不多说了,这篇博文主要记录git与github关联最简单步骤。

    一.git安装

     mac系统自带git可以直接使用,查看版本:

      $ git --version

      git version 2.14.1

    二.建立本地项目

      $mkdir blog

      假设这个是我们的项目目录,开发过程中会产长有许多源文件

    三.git本地操作

      进入项目文件夹中:

      $cd blog

      git初始化:

      $git init

    四.github初始化

      建号--》new Repositories

      1)Repositories name要和你前面的目录名保持一致

      2)下面的添README不用打钩

      点击创建

      成功后复制SSH地址

     五.创建密钥

      本地仓库与远程仓库(GitHub)通过秘钥来确认身份  

      $ ssh-keygen -t rsa -C "xxxxx@example.com"

      提示

      Generating public/private rsa key pair.

      Enter file in which to save the key (xxxx/.ssh/id_rsa):  回车

      提示

      Enter passphrase (empty for no passphrase): 

      Enter same passphrase again:

      输入密码

      出现这个图案说明成功了

    The key's randomart image is:

    +---[RSA 2048]----+

    |     .  .        |

    |    . ....       |

    | . . o =+.       |

      根据提示去打开id_rsa.pub文件,把文件内容复制下来

      打开github上面找到    

      

      点击创建new SSH key,粘贴id_rsa.pub里的内容,保存

      

     六.回到本地

      1)添加远程仓库 

       $ git remote add origin git@github.com:cracker13/blog.git

      2)提交所有文件到暂存区

      $ git add *

      3)提交至git仓库

      $ git commit -m "First commit"

      4)推送至远程库

      $ git push -u origin master

      

      

      更多操作,参考

      《GitHub入门与实践》 作者:[日] 大塚弘记

  • 相关阅读:
    1.7 All components require plug-in?
    1.6 Why only in China?
    1.5 A better alternative thing: React Native
    1.4 The usage of plug-in
    1.3 History of Android Plug-in Programing
    SQL Server 查询请求
    matplotlib 绘图的核心原理
    数据加密 第六篇:透明文件加密
    数据加密 第五篇:非对称密钥
    SSIS 数据类型 第二篇:变量的数据类型
  • 原文地址:https://www.cnblogs.com/cracker13/p/10273267.html
Copyright © 2011-2022 走看看