日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

GitHub实战系列~1.环境部署+创建第一个文件 2015-12-9

發(fā)布時間:2025/7/14 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 GitHub实战系列~1.环境部署+创建第一个文件 2015-12-9 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

GitHub實戰(zhàn)系列匯總:http://www.cnblogs.com/dunitian/p/5038719.html

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

很多人問,明明有g(shù)it gui 和 github可以直接圖形化操作的嗎?全部指令干啥???

呃(⊙o⊙)…呃(⊙o⊙)… ===>?裝逼~

O(∩_∩)O~,開玩笑的,其實就是為了通用和熟悉git,linux里面照樣這樣用,多熟悉點基礎(chǔ)指令很有用的,

如果覺得頓時不開心了、無愛了==>推薦你快速入門:http://www.imooc.com/learn/390

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

安裝系列:

軟件下載:http://git-scm.com/download/

環(huán)境搭建:(比較簡單,看圖)

下面是命令模式,需要一點點linux基礎(chǔ)(Linux基礎(chǔ)學習),沒有也沒事,看詳解

1.我們看看git的配置都有哪些:

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

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)

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

————————————————————————————————————————
2.設(shè)置名字:


git config --global user.name "你的名字"

3.設(shè)置郵箱:
git config --global user.email "你的郵箱"

————————————————————————————————————————
4.輸出更顯目的設(shè)置
git config --global color.ui auto


5.如果忘記自己的配置,就用這個命令來查看一下


cat ~/.gitconfig

————————————————————————————————————————
[user]
name = 你的名字
email = 你的郵箱
[color]
ui = auto
————————————————————————————————————————
6.設(shè)置SSH Key


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里面添加密鑰(公共)


————————————————————————————————————————
9.用手中的私人密鑰和github驗證


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里面創(chuàng)建一個公開倉庫(私有的收費)并初始化倉庫(最下面的復選框,最下面的兩個下拉列表后面說)


————————————————————————————————————————
11.復制一份github ssh庫的地址,一會兒有用


————————————————————————————————————————
12.克隆一份到本地

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.寫點東西測試一下


cd test(項目名,注意大小寫)

DNT_PC@DNT_PC-PC MINGW32 ~/test (master)
ls?(查看當前目錄有哪些東西)
README.md

DNT_PC@DNT_PC-PC MINGW32 ~/test (master)
vi dnt.txt?(如果有dnt.txt的文件就打開,沒有就創(chuàng)建一個dnt.txt的文件)

輸入你想寫的東西,i 進入編輯模式 ,按esc 輸入 :wq 并回車 是保存?
————————————————————————————————————————
14.查看git的狀態(tài) (沒提交,所以是untracked files狀態(tài))


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

nothing added to commit but untracked files present (use "git add" to track)
————————————————————————————————————————
15.把文件提交到倉庫


git add dnt.txt (添加到暫存區(qū))

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看看,發(fā)現(xiàn)這個時候是木有添加我們的文件的(不要怕)


————————————————————————————————————————
17.查看提交日記 (嚇死寶寶了,趕緊看看log)


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

add first file to my git

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

Initial commit
————————————————————————————————————————
18.原來是要push一下,更新github(如果發(fā)現(xiàn)command not found之類的問題再輸入一遍就ok了)


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

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

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.

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)

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
————————————————————————————————————————

收工,媳婦催了。。。。明天繼續(xù)

?

簡單匯總一下:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 ————————————設(shè)置—————————————————— 01.設(shè)置名字: git config --global user.name?"你的名字" 02.設(shè)置郵箱: git config --global user.email?"你的郵箱" 03.輸出更顯目的設(shè)置 git config --global color.ui auto 04.設(shè)置SSH Key ssh-keygen -t rsa -C?"你的郵箱" ————————————基礎(chǔ)—————————————————— 05.克隆一份到本地 git clone git@github.com:dunitian/test.git(ssh的項目地址) 06.把文件提交到倉庫 git add dnt.txt (添加到暫存區(qū)) git commit -m?"注釋"?(提交) 07.push一下,更新github git push ————————————查看—————————————————— 08.查看自己的配置 cat?~/.gitconfig 09.查看key cat?~/.ssh/id_rsa.pub 10.查看git的狀態(tài) git status 11.查看提交日記 git log ————————————其他——————————————————

  

《新程序員》:云原生和全面數(shù)字化實踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的GitHub实战系列~1.环境部署+创建第一个文件 2015-12-9的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。