Github 简单使用入门WindowsXP

 

本文根据http://www.36ria.com/4742改写.特此说明.

1.在github上创建一个新的版本库

image

为新建代码仓库填写信息:

image

创建完成后将会看到:

image 

2.ssh配置

本地仓库与远程通信,需要配置SSH key.

2.1检查计算机上是否已经有SSH key

进入shell:

image

输入"cd ~/.ssh"进入目录(C:\Documents and Settings\Administrator\.ssh)

image【说明】如果出现““No such file or directory”或类似的语句,说明缺少ssh的key。

2.2创建个新的SSH key

$ ssh-keygen -t rsa -C“ your_email@youremail.com

上面引号中使用您的email地址即可。

创建过程可以选择输入密码,当然也可以为空。这里为了入门简便使用,不使用密码直接生成。

image

一切顺利的话,你可以查看下C:\Documents and Settings\Administrator\.ssh=id_rsa.pub文件,复制里面的key码。

image

其中,id_rsa为密钥,id_rsa.pub为公钥。

image

2.3增加ssh key到github上

切换到账户设置页面:

image

切换到SSH keys选项卡,选择添加 SSH key:

image

使用文本编辑器,打开公钥,复制到选项卡中:

Title 标题 –SSH key的标题,自定义.

Key 公钥 –SSH key,从本地复制过来即可.

image

3.本地仓库和远程仓库通信

3.1克隆个远程仓库到本地.

假设我们存放到D:\tmpfile(进入D盘,创建tmpfile目录,进入目录)

image 克隆远程仓库到本地时需要知道远程代码仓库地址:

image

开始克隆:

$ git clone 远程地址

如:

$ git clone git@github.com:cqupt/testgithub.git

查看克隆到本地的文件:

image

【说明】由于是克隆远程版本库,已经存在远程分支origin,无需再创建。
(创建远程分支:git remote add origin 远程地址)
查看远程分支,使用git branch -r命令:

3.2推送更新到远程版本库

3.2.1修改README.md

vi README.md

a

this line is added to file :README.md

Exc

:wq

cat README.md

image

3.2.2推送本地更新到远程仓库

添加文件:

git add filename

如 git add README.md

提交到缓存:

git commit –m "这是是提交的注释"

如 git commit –m "modify README.md"

执行更新:

git push origin master

这里我们使用了新的远程仓库名称形式:

image

在github里查看修改:

image 

4.删除仓库

4.1删除本地仓库

image

4.2删除远程仓库

4.2.1进入管理

image

4.2.2删除这个仓库 (红色部分,最下面)

test

4.2.3输入仓库名称,确认删除.

image

原文地址:https://www.cnblogs.com/xilifeng/p/2713708.html