GitHub实战系列~1.条件布置+创建第一个文件 2015-12-9GitHub实战文山会海~1.环境布置+创建第一只公文 2015-12-9

 

 

GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html

GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html

——————————————————————————————————————————————————————

——————————————————————————————————————————————————————

洋洋人问,明明有git gui 和
github可以一直图形化操作的呢?全部命令干啥???

很多人数问,明明有git gui 和
github可以一直图形化操作的也?全部发令干啥???

呃(⊙o⊙)…呃(⊙o⊙)… ===> 装逼~

呃(⊙o⊙)…呃(⊙o⊙)… ===> 装逼~

O(∩_∩)O~,开玩笑的,其实就是为通用和熟悉git,linux里面还这样用,多熟悉点基础指令大有因此底,

O(∩_∩)O~,开玩笑的,其实就是是为着通用和习git,linux里面还这样用,多熟悉点基础指令大有因此底,

如若觉得这不开心了、无爱了==>推荐而速入门:http://www.imooc.com/learn/390

倘若认为就不开心了、无爱了==>推荐而快入门:http://www.imooc.com/learn/390

———————————————————————————————————————————————————————

———————————————————————————————————————————————————————

设置系列:

设置系列:

软件下充斥:http://git-scm.com/download/

软件下充斥:http://git-scm.com/download/

条件搭建:(比较简单,看图)

环境搭建:(比较简单,看图)

图片 1

图片 2

图片 3

图片 4

图片 5

图片 6

图片 7

图片 8

图片 9

图片 10

图片 11

图片 12

图片 13

图片 14

图片 15

图片 16

脚是命令模式,需要一点点linux基础(Linux基础学习),没有吗清闲,看详解

脚是命令模式,需要一点点linux基础(Linux基础学习),没有也清闲,看详解

1.我们看git的布局都起什么:

1.咱们看看git的配置都来安:

图片 17

图片 18

git config
————————————————————————————————————————
usage: git config [<options>]

git config
————————————————————————————————————————
usage: git config [<options>]

Config file location
–global use global config file
–system use system config file
–local use repository config file
-f, –file <file> use given config file
–blob <blob-id> read config from given blob object

Config file location
–global use global config file
–system use system config file
–local use repository config file
-f, –file <file> use given config file
–blob <blob-id> read config from given blob object

Action
–get get value: name [value-regex]
–get-all get all values: key [value-regex]
–get-regexp get values for regexp: name-regex [value-regex]
–get-urlmatch get value specific for the URL: section[.var] URL
–replace-all replace all matching variables: name value [value_rege
x]
–add add a new variable: name value
–unset remove a variable: name [value-regex]
–unset-all remove all matches: name [value-regex]
–rename-section rename section: old-name new-name
–remove-section remove a section: name
-l, –list list all
-e, –edit open an editor
–get-color find the color configured: slot [default]
–get-colorbool find the color setting: slot [stdout-is-tty]

Action
–get get value: name [value-regex]
–get-all get all values: key [value-regex]
–get-regexp get values for regexp: name-regex [value-regex]
–get-urlmatch get value specific for the URL: section[.var] URL
–replace-all replace all matching variables: name value [value_rege
x]
–add add a new variable: name value
–unset remove a variable: name [value-regex]
–unset-all remove all matches: name [value-regex]
–rename-section rename section: old-name new-name
–remove-section remove a section: name
-l, –list list all
-e, –edit open an editor
–get-color find the color configured: slot [default]
–get-colorbool find the color setting: slot [stdout-is-tty]

Type
–bool value is “true” or “false”
–int value is decimal number
–bool-or-int value is –bool or –int
–path value is a path (file or directory name)

Type
–bool value is “true” or “false”
–int value is decimal number
–bool-or-int value is –bool or –int
–path value is a path (file or directory name)

Other
-z, –null terminate values with NUL byte
–name-only show variable names only
–includes respect include directives on lookup

Other
-z, –null terminate values with NUL byte
–name-only show variable names only
–includes respect include directives on lookup

————————————————————————————————————————
2.安名字:

————————————————————————————————————————
2.装名字:

图片 19
git config –global user.name
“你的讳”

图片 20
git config –global user.name
“你的名字”

3.设置邮箱:
git config –global user.email
“你的邮箱”

3.装邮箱:
git config –global user.email
“你的邮箱”

————————————————————————————————————————
4.出口更显眼的装置
git config –global color.ui
auto

————————————————————————————————————————
4.出口更明确的设置
git config –global color.ui
auto

5.如果忘记自己之布局,就因故者令来查阅转

5.如果忘记自己之配置,就就此此命令来查转

图片 21
cat ~/.gitconfig

图片 22
cat ~/.gitconfig

————————————————————————————————————————
[user]
name = 你的名字
email = 你的信箱
[color]
ui = auto
————————————————————————————————————————
6.设置SSH Key

————————————————————————————————————————
[user]
name = 你的讳
email = 你的信箱
[color]
ui = auto
————————————————————————————————————————
6.设置SSH Key

图片 23
ssh-keygen -t rsa -C
“你的邮箱”

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/DNT_PC/.ssh/id_rsa):
回车一下
/c/Users/DNT_PC/.ssh/id_rsa already exists.
Overwrite (y/n)? 回车一下
————————————————————————————————————————
7.记不得key用之命令:

图片 24
ssh-keygen -t rsa -C
“你的邮箱”

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/DNT_PC/.ssh/id_rsa):
回车一下
/c/Users/DNT_PC/.ssh/id_rsa already exists.
Overwrite (y/n)? 回车一下
————————————————————————————————————————
7.记不得key用此命令:

$ cat ~/.ssh/id_rsa.pub
————————————————————————————————————————
ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQD3joLDvLaBHnP4aMJwcjo6gjcipBoOnCzETPkQBu+LdBit8L3CSltQ6AhgOL8xcUHxR+ZojdNhd0XXvOfIfuPJVBH57dqptvAeqDkQHiBE5lX2/7pjPVPHSeTiQd0ijYtc1HxtqMo4U++sR6M7QYXPFnHBogUmZdxItVWr***********************4H2h19aIUImZU2KLndgP1AYGFh1FsprWO0oa6ebsIsPGtgrtHqBfHd9e2yF0/1fIFhidXgGvgmt4K9nO0WJ24vW****************
————————————————————————————————————————
8.每当github里面添加密钥(公共)

$ cat ~/.ssh/id_rsa.pub
————————————————————————————————————————
ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQD3joLDvLaBHnP4aMJwcjo6gjcipBoOnCzETPkQBu+LdBit8L3CSltQ6AhgOL8xcUHxR+ZojdNhd0XXvOfIfuPJVBH57dqptvAeqDkQHiBE5lX2/7pjPVPHSeTiQd0ijYtc1HxtqMo4U++sR6M7QYXPFnHBogUmZdxItVWr***********************4H2h19aIUImZU2KLndgP1AYGFh1FsprWO0oa6ebsIsPGtgrtHqBfHd9e2yF0/1fIFhidXgGvgmt4K9nO0WJ24vW****************
————————————————————————————————————————
8.于github里面添加密钥(公共)

图片 25

图片 26

图片 27
————————————————————————————————————————
9.用手中的私人密钥和github验证

图片 28
————————————————————————————————————————
9.用手中的亲信密钥和github验证

图片 29
ssh -T git@github.com
————————————————————————————————————————
The authenticity of host ‘github.com (192.30.252.128)’ can’t be
established.
RSA key fingerprint is
SHA256:nThbg6k*************************viKw6E5********.
Are you sure you want to continue connecting (yes/no)? 输入yes
Warning: Permanently added ‘github.com,192.30.252.128’ (RSA) to the list
of known hosts.
Hi 你的人名! You’ve successfully authenticated, but GitHub does not
provide shell access.
————————————————————————————————————————
10.于github里面创建一个明仓库(私有的收费)并初始化仓库(最下面的复选框,最下的有数单下拉列表后面说)

图片 30
ssh -T git@github.com
————————————————————————————————————————
The authenticity of host ‘github.com (192.30.252.128)’ can’t be
established.
RSA key fingerprint is
SHA256:nThbg6k*************************viKw6E5********.
Are you sure you want to continue connecting (yes/no)? 输入yes
Warning: Permanently added ‘github.com,192.30.252.128’ (RSA) to the list
of known hosts.
Hi 你的真名! You’ve successfully authenticated, but GitHub does not
provide shell access.
————————————————————————————————————————
10.当github里面创建一个明仓库(私有的收费)并初始化仓库(最下面的复选框,最下的一定量独下拉列表后面说)

图片 31

图片 32

图片 33
————————————————————————————————————————
11.复制同样卖github ssh库的地方,一会儿生出因此

图片 34
————————————————————————————————————————
11.复制一样份github ssh库的地址,一会儿起因此

图片 35
————————————————————————————————————————
12.克隆一样卖到当地

图片 36
————————————————————————————————————————
12.克隆一律客到当地

git clone
git@github.com:dunitian/test.git(刚才之地方)

git clone
git@github.com:dunitian/test.git(刚才的地点)

————————————————————————————————————————
Cloning into ‘test’…
Warning: Permanently added the RSA host key for IP address
‘192.30.252.131’ to the list of known hosts.
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
Checking connectivity… done.
————————————————————————————————————————
13.状点东西测试一下

————————————————————————————————————————
Cloning into ‘test’…
Warning: Permanently added the RSA host key for IP address
‘192.30.252.131’ to the list of known hosts.
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
Checking connectivity… done.
————————————————————————————————————————
13.勾点东西测试一下

图片 37
cd test(项目名为,注意分寸写)

图片 38
cd test(项目名为,注意分寸写)

DNT_PC@DNT_PC-PC MINGW32 ~/test (master)
ls (查看当前目录有哪些东西)
README.md

DNT_PC@DNT_PC-PC MINGW32 ~/test (master)
ls (查看当前目录有什么样东西)
README.md

DNT_PC@DNT_PC-PC MINGW32 ~/test (master)
vi dnt.txt
(如果有dnt.txt的文件就打开,没有就创造一个dnt.txt的文本)

DNT_PC@DNT_PC-PC MINGW32 ~/test (master)
vi dnt.txt
(如果发dnt.txt的文件就开辟,没有就创造一个dnt.txt的文书)

图片 39

图片 40

输入你想写的物,i 进入编辑模式 ,按esc 输入 :wq 并回车 是保存
————————————————————————————————————————
14.查看git的状态 (没提交,所以是untracked files状态)

输入你想写的东西,i 进入编辑模式 ,按esc 输入 :wq 并回车 是保存
————————————————————————————————————————
14.查看git的状态 (没提交,所以是untracked files状态)

图片 41
git status
————————————————————————————————————————
On branch master
Your branch is up-to-date with ‘origin/master’.
Untracked files:
(use “git add <file>…” to include in what will be committed)

图片 42
git status
————————————————————————————————————————
On branch master
Your branch is up-to-date with ‘origin/master’.
Untracked files:
(use “git add <file>…” to include in what will be committed)

dnt.txt

dnt.txt

nothing added to commit but untracked files present (use “git add” to
track)
————————————————————————————————————————
15.将文件提交到仓库

nothing added to commit but untracked files present (use “git add” to
track)
————————————————————————————————————————
15.拿公文提交至库房

图片 43
git add dnt.txt
(添加到暂存区)

图片 44
git add dnt.txt
(添加到暂存区)

图片 45

图片 46

git commit -m “add first file to my git”
(提交;引号里面是注释)

————————————————————————————————————————
[master 4e69105] add first file to my git
warning: LF will be replaced by CRLF in dnt.txt.
The file will have its original line endings in your working
directory.
1 file changed, 1 insertion(+)
create mode 100644 dnt.txt
————————————————————————————————————————
16.到github看看,发现这时是木有添加我们的文本的(不要惧怕)

git commit -m “add first file to my git”
(提交;引号里面凡是注释)

————————————————————————————————————————
[master 4e69105] add first file to my git
warning: LF will be replaced by CRLF in dnt.txt.
The file will have its original line endings in your working
directory.
1 file changed, 1 insertion(+)
create mode 100644 dnt.txt
————————————————————————————————————————
16.交github看看,发现此时刻是木有添加我们的公文之(不要惧怕)

图片 47
————————————————————————————————————————
17.查看提交日记 (吓死宝宝了,赶紧看看log)

图片 48
————————————————————————————————————————
17.翻提交日记 (吓死宝宝了,赶紧看看log)

图片 49
git log
————————————————————————————————————————
commit 4e6910512df341e6d71d83607df8f44a6bd5a5b6
Author: dunitian <1054186320@qq.com>
Date: Wed Dec 9 22:26:44 2015 +0800

图片 50
git log
————————————————————————————————————————
commit 4e6910512df341e6d71d83607df8f44a6bd5a5b6
Author: dunitian <1054186320@qq.com>
Date: Wed Dec 9 22:26:44 2015 +0800

add first file to my git

add first file to my git

commit 6f4fa43de0619c34345fb65d1b32ed887d4efd04
Author: dunitian <1054186320@qq.com>
Date: Wed Dec 9 21:30:07 2015 +0800

commit 6f4fa43de0619c34345fb65d1b32ed887d4efd04
Author: dunitian <1054186320@qq.com>
Date: Wed Dec 9 21:30:07 2015 +0800

Initial commit
————————————————————————————————————————
18.原先是如果push一下,更新github(如果发现command not
found之类的题目又输入一满就是ok了)

Initial commit
————————————————————————————————————————
18.原来是要push一下,更新github(如果发现command not
found之类的题材再次输入一不折不扣就是ok了)

图片 51
git push
————————————————————————————————————————
warning: push.default is unset; its implicit value has changed in
Git 2.0 from ‘matching’ to ‘simple’. To squelch this message
and maintain the traditional behavior, use:

图片 52
git push
————————————————————————————————————————
warning: push.default is unset; its implicit value has changed in
Git 2.0 from ‘matching’ to ‘simple’. To squelch this message
and maintain the traditional behavior, use:

git config –global push.default matching

git config –global push.default matching

To squelch this message and adopt the new behavior now, use:

To squelch this message and adopt the new behavior now, use:

git config –global push.default simple

git config –global push.default simple

When push.default is set to ‘matching’, git will push local branches
to the remote branches that already exist with the same name.

When push.default is set to ‘matching’, git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative ‘simple’
behavior, which only pushes the current branch to the corresponding
remote branch that ‘git pull’ uses to update the current branch.

Since Git 2.0, Git defaults to the more conservative ‘simple’
behavior, which only pushes the current branch to the corresponding
remote branch that ‘git pull’ uses to update the current branch.

See ‘git help config’ and search for ‘push.default’ for further
information.
(the ‘simple’ mode was introduced in Git 1.7.11. Use the similar mode
‘current’ instead of ‘simple’ if you sometimes use older versions of
Git)

See ‘git help config’ and search for ‘push.default’ for further
information.
(the ‘simple’ mode was introduced in Git 1.7.11. Use the similar mode
‘current’ instead of ‘simple’ if you sometimes use older versions of
Git)

Counting objects: 3, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 294 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:dunitian/test.git
6f4fa43..4e69105 master -> master
————————————————————————————————————————

Counting objects: 3, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 294 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:dunitian/test.git
6f4fa43..4e69105 master -> master
————————————————————————————————————————

下班,媳妇催了。。。。明天持续

下班,媳妇催了。。。。明天后续

图片 53

图片 54

 

 

简简单单汇总一下:

简单易行汇总一下:

————————————设置——————————————————

01.设置名字:
git config --global user.name "你的名字"

02.设置邮箱:
git config --global user.email "你的邮箱"

03.输出更显目的设置
git config --global color.ui auto

04.设置SSH Key
ssh-keygen -t rsa -C "你的邮箱"

————————————基础——————————————————

05.克隆一份到本地
git clone git@github.com:dunitian/test.git(ssh的项目地址)

06.把文件提交到仓库
git add dnt.txt (添加到暂存区)
git commit -m "注释" (提交)

07.push一下,更新github
git push

————————————查看——————————————————

08.查看自己的配置
cat ~/.gitconfig

09.查看key
cat ~/.ssh/id_rsa.pub

10.查看git的状态 
git status

11.查看提交日记
git log

————————————其他——————————————————
————————————设置——————————————————

01.设置名字:
git config --global user.name "你的名字"

02.设置邮箱:
git config --global user.email "你的邮箱"

03.输出更显目的设置
git config --global color.ui auto

04.设置SSH Key
ssh-keygen -t rsa -C "你的邮箱"

————————————基础——————————————————

05.克隆一份到本地
git clone git@github.com:dunitian/test.git(ssh的项目地址)

06.把文件提交到仓库
git add dnt.txt (添加到暂存区)
git commit -m "注释" (提交)

07.push一下,更新github
git push

————————————查看——————————————————

08.查看自己的配置
cat ~/.gitconfig

09.查看key
cat ~/.ssh/id_rsa.pub

10.查看git的状态 
git status

11.查看提交日记
git log

————————————其他——————————————————

  

  

相关文章