http://blog.csdn.net/banxi1988/article/details/6555293

<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } H2 { margin-bottom: 0.21cm } H2.cjk { font-family: "宋体" } H2.ctl { font-family: "Lohit Hindi" } PRE.cjk { font-family: "宋体", monospace } A:link { so-language: zxx } -->

Github 使用指南!(下文针对linux系统而言,特指ubuntu系统)

第一步:

下载安装Git。

  1. 使用新立得软件包管理工具(Synaptic Package Manager)安装最新版本的git。

    推荐选择安装git-core,git-gui,git-doc。

第二步:设置SSH Keys

github使用ssh keys来确保你的电脑与github的连接有安全性。设置过程很简单。

但是有几个步骤。

步骤一:检查已有的ssh keys。

$ cd ~/.ssh

如果提示说,没有这样的文件或者目录。(No such file or directory) 则跳到步骤三。否则继续。

步骤二:备份已有的ssh keys。

步骤三:产生一个新的 ssh key。

我的产生过程如下:

banxi1988@banxi:~$ ssh-keygen -t rsa -C "banxi1988@gmail.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/home/banxi1988/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Passphrases do not match. Try again.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/banxi1988/.ssh/id_rsa.

Your public key has been saved in /home/banxi1988/.ssh/id_rsa.pub.

The key fingerprint is:

0c:a5:4d:a7:d8:e8:42:b2:5c:75:d0:4c:e5:ff:6a:7f banxi1988@gmail.com

The key's randomart image is:

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

| o==.o |

| . Xo+ |

| . o = + . |

| . = . o . |

| o . . S . |

| . . |

| . |

| .. E|

| ..... |

+-----------------+

banxi1988@banxi:~$

步骤四:

在gitHub里单击账户设置。点击SSH 公钥 ,点击添加另一个公钥。

打开前面生成的id_rsa.pub 文件。(可能要显示隐藏文件才能看到用gedit或者其它的编辑器打开。

注意不要编辑,添加空格或者换行。)

然后把里面的内容复制粘贴到下面的key输入栏中。

步骤五:测试一下。

banxi1988@banxi:~$ ssh git@github.com

/etc/ssh/ssh_config: line 20: Bad configuration option: X11Forwrding

/etc/ssh/ssh_config: terminating, 1 bad configuration options

banxi1988@banxi:~$

After modify the ssh_config.中间要求输入上面输入的passphrase。

banxi1988@banxi:~$ ssh git@github.com

The authenticity of host 'github.com (207.97.227.239)' can't be established.

RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.

PTY allocation request failed on channel 0

Hi banxi1988! You've successfully authenticated, but GitHub does not provide shell access.

Connection to github.com closed.

banxi1988@banxi:~$

步骤六:设置git的个人信息。

1. 设置用户名和email。git使用这个来验证每个提交者。除此之外github会使用这些信息来

与你的github账号相联系。下面的名字应该是你真实的名字。而不是要GitHub的用户名。

banxi1988@banxi:~$ git config --global user.name "Li HaiZhen"

banxi1988@banxi:~$ git config --global user.email "banxi1988@gmail.com"

banxi1988@banxi:~$

2. 设置GitHub的指令环。

有些工具不使用ssh来连接。为了使用这些工具。你应该找出配置好你的API Token。

在GitHub上点击。账号设置(Account Settings) ,然后点击 账号管理(Account Admin)。

在API Token一栏里有你的API ToKen。

在命令行下运行下面的代码。

banxi1988@banxi:~$ git config --global github.user banxi1988

banxi1988@banxi:~$ git config --global github.token e5ebe68d43d9820ed8d05a3d2633d7f3

banxi1988@banxi:~$

上面使用的user是指GitHub的用户名了。

最后:恭喜你!你已经正确的设置了git和gitHub。

接下来。要做的就是。1. 创建一个仓库。2. Fork 一个仓库。 3.社区化。

第二节:创建一个仓库(Create A Repo Repositories)

直接在自己的登录后进入github.com首页就可以看到, 下面一栏有四步.用来创建Repository.

直接填入项目名称就可以了.其它的可以不填.要填,这个表单也足够自解释了.

创建后之后.会跳转到一个页面.其中有指示接下来该怎么做的.

如下:

git@github.com:banxi1988/tasteHibernate.git

接下来给你自己的项目创建一个基本的Readme文件吧.

详细操作过程如下:

Global setup:

Download and install Git
 git config --global user.name "banxi1988"
  git config --global user.email banxi1988@gmail.com

Next steps:

  mkdir tasteHibernate
  cd tasteHibernate
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin git@github.com:banxi1988/tasteHibernate.git
  git push -u origin master

Existing Git Repo?

  cd existing_git_repo
  git remote add origin git@github.com:banxi1988/tasteHibernate.git
  git push -u origin master

Importing a Subversion Repo?

Click here

When you're done:

Continue

banxi1988@banxi:~/github/tasteHibernate$ git init

Initialized empty Git repository in /home/banxi1988/github/tasteHibernate/.git/

banxi1988@banxi:~/github/tasteHibernate$ touch README

banxi1988@banxi:~/github/tasteHibernate$ vi README

banxi1988@banxi:~/github/tasteHibernate$ git add README

banxi1988@banxi:~/github/tasteHibernate$ git commit -m 'first commit'

[master (root-commit) 6ec8aae] first commit

1 files changed, 6 insertions(+), 0 deletions(-)

create mode 100644 README

banxi1988@banxi:~/github/tasteHibernate$ git remote add origin git@github.com:banxi1988/tasteHibernate.git

banxi1988@banxi:~/github/tasteHibernate$ git push origin master

ERROR: banxi1988/tasteHibernate.git doesn't exist. Did you enter it correctly?

fatal: The remote end hung up unexpectedly

banxi1988@banxi:~/github/tasteHibernate$ git push -u origin master

Counting objects: 3, done.

Delta compression using up to 2 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 383 bytes, done.

Total 3 (delta 0), reused 0 (delta 0)

To git@github.com:banxi1988/tasteHibernate.git

* [new branch] master -> master

Branch master set up to track remote branch master from origin.

banxi1988@banxi:~/github/tasteHibernate$

关于Git的命令请参见Git手册.

现在我们已经可以创建了一个库了.创建了一个文件,并且提交了.并且把它推向了github.

接下来我们将做什么呢?

第三节: Fork A Repo

有些时候你发现自己想要为别人的项目做贡献.或者希望来使用别人的项目做为自己的起点.也就称之为Fork.

  1. Fork一个项目. 在你想fork的项目的首页.找到fork按钮.点击.

  2. 接下来设置你本地仓库.

    A . 克隆项目.

    $ git clone git@github.com:username/projectname.git

    B. 远程配置.

    当你克隆了一个项目之后.它有一个默认的remote.叫做.origin.这是指你是在github上fork的.而不是在原来的仓库.为了跟踪原本的仓库,你需要添加另一个叫做upstream的选项.

    $cd projectname

    $ git remote add upstream git://github.com/username/projectname.git

    $ git fetch upstream

    1. 接下来.你要做的就是.

      A. 推送提交.

      一旦你做出了某些提交到你fork的仓库里,你可能想要将其推送到你fork的项目去.你要做就跟平常的项目一样.

      $git push origin master

      1. 接收upstream 变更.

        如果你fork的那个原来的仓库改变了,你可以使用下面的命令来更新你fork到本地的仓库.

        $ git fetch upstream

        $ git merge upstream/master

后面的更多使用指南请参考相关文档.例如创建分支等.

本指南是由banxi1988根据github提供的帮助.进行的实践之后,翻译过来的.

由于本人水平有限.所以翻译得不好,你可以向我提意见或者直接到github里面的去看帮助.

转载于:https://www.cnblogs.com/balaamwe/archive/2012/04/12/2444203.html

GitHub使用指南!(ubuntu)相关推荐

  1. github初学者指南_GitHub初学者指南

    github初学者指南 从Google到白宫,每个人都在GitHub上 . 如果您不知道GitHub是什么,请继续阅读,因为我还将讨论为什么它是我最喜欢的网站之一,并分享一些最受欢迎的功能. 什么是G ...

  2. github使用指南_GitHub 上的 12 个骚操作

    H5前端开发社区专注更多编程教程和电子书天天在用钱 原文:https://hackernoon.com/12-cool-things-you-can-do-with-github-f3e0424cf2 ...

  3. Git 经验总结及 Git GitHub 学习指南

    1. 前言 本文主要分为两部分,前一部分是本人学习和工作中使用 Git 的总结经验,后半部分是总结的 Git & GitHub 的学习指南.如果想直接体系学习,可以直接按照指南路线学习.如果你 ...

  4. Github全程指南-如何高效使用

    Github全程指南-如何高效使用 2016年06月29日 11:32:38 阅读数:2535 作为一名开发者,Github上面有很多东西值得关注学习,可是刚刚接触github,怎样一步步学习使用Gi ...

  5. 对初学者友好的Git和Github使用指南之介绍和安装篇

    本文首发在个人博客:ladyzero.cool,欢迎前往阅读,阅读体验更佳. 原文地址:对初学者友好的Git和Github使用指南之介绍和安装篇 前言 本文将初步介绍Github和Git是什么,以及介 ...

  6. github 和git_Git和GitHub入门指南

    github 和git 什么是Git? (What is Git?) Git is a free, open-source version control software. It was creat ...

  7. Ubuntu桌面生存指南 --- Ubuntu常用效率软件简介

    Ubuntu常用效率软件简介 之前的一系列博客里,基本上我们夯实了使用Ubuntu系统所需的基础知识,这一篇里我们来谈谈在这个低调而强大的平台上,如何使得操作者遵循系统的设计理念,通过恰当的选用软件, ...

  8. 「Github」Linux/Ubuntu下终端Github教程与手册

    1 前期准备 1.1 环境说明 系统:Ubuntu 18.04 1.2 前期准备 打开终端,确保git命令可使用:如果不能使用请自行搜索如何安装git 建议新建一个专门存储各个仓库的文件夹(假定文件夹 ...

  9. git 获取最新代码_程序员必知:这是一份全面 amp; 详细的 Git与Github 介绍指南

    前言 如果你从事 互联网技术研发,那么你一定需要 了解 Git & Github 本文将采用 图 & 表的方式,向你全面介绍 Git 与 Github,包括其功能.应用场景 & ...

最新文章

  1. 减少过敏反应的生活细节
  2. 如何用Postman组装Request并且查看Response
  3. 常州大学阿里云大数据学院举行“创新思维”课程答辩
  4. Visual C#使用ADO.NET自定义类MyDBase连接SQL Server数据库
  5. 2287. 【POJ Challenge】消失之物(数组递推\分治优化背包)
  6. php防撞库,叉车防撞预警系统的必要性
  7. java查询比对是否重复_java-对象的ArrayList,比较对象并查找重复项,...
  8. 布局篇(1)—If you love css …
  9. 阿里云云计算 16 块存储的概念
  10. 589页22万字城市智慧应急指挥中心大数据信息化系统整体设计方案
  11. CSS之display用法
  12. Spring学习总结01--Spring了解,IOC,DI
  13. 机器学习实战—逻辑回归—信用卡欺诈检测
  14. 科普|股东需要对企业债务承担连带责任
  15. 记录华夏ERP配置报错
  16. socket c语言 AF_TIPC,socket编程 send() recv() sendto() recvfrom()
  17. 校招回顾,大疆校招可内推
  18. Source Insight使用教程(一):导入工程
  19. pom文件分析(笔记)
  20. ADN: Artifact Disentanglement Network for Unsupervised Metal Artifact Reduction

热门文章

  1. mysql 事务id_[转]MySQL 5.6 全局事务 ID(GTID)实现原理(一)
  2. 测试MM32F3277-MicroPython 2021-11-17 版本
  3. 2021年信号与系统期中考试的补测试题
  4. 2021年春季学期-信号与系统-第二次作业参考答案-第二小题
  5. 安装HikVision(海康威视)网络摄像头
  6. list.add时报错:Exception in thread “main“ java.lang.UnsupportedOperationException
  7. java jdbc效率_Java JDBC效率:连接需要多长时间?
  8. 2021高考成绩各科各题得分查询,2021年新疆高考分数一分一段位次表,新疆高考个人成绩排名查询方法...
  9. NETCONF 环境搭建
  10. 设备树 xlnx-phy 使用