Atitit.软体guibuttonand面板---通信子系统(范围)-- github 采用....

时间:2023-03-09 17:45:48
Atitit.软体guibuttonand面板---通信子系统(范围)-- github 采用....

Atitit.软体guibuttonand面板---通讯子系统(区)-- github 的使用....

1. 1.注冊账户以及创建仓库
1

2. 二.在GitHub中创建项目(create a new repo)。
1

3. windows下安装Git
2

3.1. 安装clientmsysgit 3

4. .配置Git  ssh key 3

4.1.  3

5. 对库进行clone。例如以下:  git clone https://github.com/xrong/xxxx.git    (xxx为项目仓库名称)
4

6. 3.上传代码项目到GitHub中
4

1. 1.注冊账户以及创建仓库

要想使用github第一步当然是注冊github账号了。之后就能够创建仓库了(免费用户仅仅能建公共仓库)。Create a New Repository。填好名称后Create。之后会出现一些仓库的配置信息,这也是一个git的简单教程。

作者:: 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://blog.****.net/attilax

2. 二.在GitHub中创建项目(create a new repo)。

登陆GitHub页面,在右上角点击create a new repobutton,例如以下图,输入相关信息后点击create repository后完毕创建项目。

然后页面就会跳转到repo以下,在地址栏中会看到 https://github.com/xrong/xxxxx.git  这个就是你这个项目的地址了(xxxx为你的项目名称)。

3. windows下安装Git

能够到这个站点下载安装 http://windows.github.com/

3.1. 安装clientmsysgit

github是服务端。要想在自己电脑上使用git我们还须要一个gitclient,我这里选用msysgit,这个仅仅是提供了git的核心功能。并且是基于命令行的。假设想要图形界面的话仅仅要在msysgit的基础上安装TortoiseGit就可以。

装完msysgit后右键鼠标会多出一些选项来。在本地仓库里右键选择Git Init Here,会多出来一个.git目录,这就表示本地git创建成功。

右键Git Bash进入git命令行,为了把本地的仓库传到github,还须要配置ssh key

4. .配置Git  ssh key

4.1.

首先在本地创建ssh key;

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

后面的your_email@youremail.com改为你的邮箱,之后会要求确认路径和输入password,我们这使用默认的一路回车即可。

成功的话会在~/下生成.ssh目录,进去,打开id_rsa.pub,复制里面的key。

回到github。进入Account Settings。左边选择SSH Keys。Add SSH Key,title随便填,粘贴key。

为了验证是否成功,在git bash下输入:

$ ssh -T git@github.com

假设是第一次的会提示是否continue。输入yes就会看到:You’ve successfully authenticated, but GitHub does not provide shell access 。这就表示已成功连上github。

接下来我们要做的就是把本地仓库传到github上去,在此之前还须要设置username和email,由于github每次commit都会记录他们。

$ git config --global user.name "your name"

5. 对库进行clone,例如以下: 

git clone https://github.com/xrong/xxxx.git   (xxx为项目仓库名称)

6. 3.上传代码项目到GitHub中

git add .

一般假设你想分享这个目录里的全部代码,就在 add后面加“.”,上面的样例就是这样,假设传指定的,仅仅须要把“.”改为文件名称就可以,如今仅仅是选择了要加入仓库的文件,以下才是加入进入仓库:

git commit -m 'first_commit'

-m后面跟一个參数。表示说明,将代码提交到GitHub后,将会在代码文件信息上显示这个说明

git remote add origin https://github.com/xrong/xxxx.git

git remote add name url 在url创建名字为name的远端仓库(Adds a remote named <name> for the repository at <url>) 

name为远程仓库的名字

git push origin master

提交本地origin分支作为远程的master分支

假设运行git remote add origin https://github.com/xrong/xxxx.git ,出现错误:

fatal: remote origin already exists

则运行下面语句:

git remote rm origin

须要移除相应的远端仓库

再往后运行git remote add origin https://github.com/xrong/xxxx.git 就可以。

在运行git push origin master时。报错:

error:failed to push som refs to.......

则运行下面语句:

git pull origin master 

git pull:相当于是从远程获取最新版本号并merge到本地 

上述命令事实上相当于git fetch 和 git merge 

在实际使用中,git fetch更安全一些。先把远程servergithub上面的文件拉先来,再push 上去。

7. Git的缺点

每时间都要username,pwd 每提交的时候儿...麻烦的..

8. 參考

怎样使用github?github简单使用教程(转)_洋柿子炒青椒_新浪博客.htm

GitHub当道,菜鸟也为Git疯狂 - 推酷.htm

Git错误non-fast-forward后的冲突解决 - chain - 努力がゆえに淋しく、孤独がゆえに強くなる - 博客频道 - ****.NET.htm

版权声明:本文博主原创文章,博客,未经同意,不得转载。