git(三):第一次github了解使用

第一次使用github,看了一下使用说明,创建第一个repository,以后还要多学习。

 

一、Github创建一个新仓库
······Creat a new repository 创建一个新仓库,点击github右上角的+里面的new repository
  在repository name栏中输入仓库的名称
  description 栏中可以设置仓库的说明
  piblic(公开)通用 private(非公开)收费
  勾选Initialize this repository with a README ,如果想向GitHub添加手中已有的Git仓库,建议不要勾选
  Add.gitignore 下拉框中选择要使用的框架
  Add a license选择添加许可协议文件
  点击create repository按钮,
  完成仓库的创建   
 
二、将本地文件托管到github
 
 打开git bash进入到项目路径,也可以直接在项目里打开git bash
$ git remote add origin 仓库地址
//添加一个远端的项目
$ git push -u origin master

 

//获取一个远端文件
$ git pull origin master

这里有一个问题git clone和git pull的区别。

二、创建github分支

//管理分支  显示所有分支表,同时确认当前所在的分支
$ git branch

 

 
//创建分支(必须写gh-pages)
$ git branch gh-pages

 

//切换到分支gh-pages
$ git checkout gh-pages

 

//同步项目到分支
$ git push -u origin gh-pages
//删除分支
$ git branch -d  branch_name

 

 

 

posted @ 2019-03-08 14:47  居老师的狗子  阅读(239)  评论(0编辑  收藏  举报