Github 基本使用

github

GitHub是一个通过Git进行版本控制的软件源代码托管服务,由GitHub公司(曾称Logical Awesome)的开发者Chris Wanstrath、PJ Hyett和Tom Preston-Werner使用Ruby on Rails编写而成。 — 来自 维基百科 

我们打开网站, 输入邮箱和密码, 就可以完成简单的注册功能.

创建一个github仓库

那我们现在就去创建一个仓库.

Repository name: 要创建git仓库的名子

Description: 这个仓库的简单描述, 让别人很快的了解这个库是做什么用的.

Public: 表示这个仓库是公开的, 任何人都可看到, 可以随意下载, 这就是传说中的开源.

Private: 私有库, 只能指定相关的人员才能看到并能下载. 这一般是公司或组织使用的私有项目, 这需要每个月向github交$7.

Initialze this Repository with a README: 初始生成README文件, .gitignore和license文件.

使用github仓库

github仓库的使用

创建github仓库后, 我有3种方法可以下载使用它.

如果我们本地没有git仓库, 可以先在本地创建一个git仓库, 并做一个提交. 然后再互github远程仓库进行关联.

echo "# abc" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/wangleihd/freeBook-H5.git
git push -u origin master

我们本地已经有git仓库了, 那我们现在就直接与github仓库进行关联就可以了.

git remote add origin https://github.com/wangleihd/freeBook-H5.git
git push -u origin master

我们还可以用clone直接去下载这个项目, 这也是最常用下载或拉取github仓库的方法.

$ git clone https://github.com/wangleihd/freeBook-H5.git

原文地址:https://www.cnblogs.com/mophy/p/7016216.html