程式碼管理-2-git、github、gitlab

安裝與初始化

系統環境準備

系統:CentOS8

[root@tyschool1 ~]# sestatus -vSELinux status: disabled[root@tyschool1 ~]# systemctl status firewalld● firewalld。service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld。service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1)[root@tyschool1 ~]# dnf repolist上次元資料過期檢查:6:26:44 前,執行於 2020年04月02日 星期四 23時17分37秒。倉庫標識 倉庫名稱 狀態app app 4,681os os 1,655

Git安裝部署

[root@tyschool1 ~]# dnf install gitGit 自帶一個 git config 的工具來幫助設定控制 Git 外觀和行為的配置變數。 這些變數儲存在三個不同的位置:[root@tyschool1 ~]# git config——system 系統配置檔案 配置內容會存放在/etc/gitconfig中,包含系統上每一個使用者及他們的倉庫的通用配置,需要管理員許可權——global 全域性配置檔案 配置內容會存放在~/。gitconfig或者~/。config/git/gitconfig中——local 本地的配置檔案 配置檔案存放在git工作目錄的。git/config中注:配置檔案的優先順序local>global>system,可以使用git config -h去獲取相關幫助,也可以使用git config ——list ——show-origin檢視所有的配置及所在的檔案。[root@tyschool1 ~]# git config ——global user。name “hello”#定義git使用者[root@tyschool1 ~]# git config ——global user。email “hello@localhost#定義git使用的郵箱[root@tyschool1 ~]# git config ——global color。ui true#定義語法高亮[root@tyschool1 ~]# git config ——listuser。name=hellouser。email=hello@localhostcolor。ui=true#檢視定義的資訊[root@tyschool1 ~]# pwd/root[root@tyschool1 ~]# cat 。gitconfig [user] name = hello email = hello@localhost[color] ui = true

git初始化

初始化工作目錄、主要用來初始化一個空的git本地倉庫。執行完上面的命令,當前目錄下會自動生成。git隱藏資料夾,

#建立工作目錄mkdir git_datacd git_data/#初始化git init#檢視工作區狀態git status[root@tyschool1 git_data]# pwd/root/git_data[root@tyschool1 git_data]# git status 位於分支 master尚無提交無檔案要提交(建立/複製檔案並使用 ”git add“ 建立跟蹤)

隱藏檔案介紹:[root@tyschool1 git_data]# pwd/root/git_data[root@tyschool1 git_data]# ls -a。 。。 。git[root@tyschool1 git_data]# cd 。git/[root@tyschool1 。git]# lsbranches config description HEAD hooks info objects refsbranches # 分支目錄 config # 儲存配置資訊 description # 僅供git web程式使用 HEAD # 記錄當前的分支指向 hooks # 包含指令碼檔案 info # 包含一個全域性排除檔案(exclude檔案),可以將不想被git處理的檔案定義到exclude檔案中 objects # 存放所有資料內容 ,有info和pack兩個子資料夾(實際也就是本地倉庫的目錄)refs # 這個目錄一般包括三個子資料夾,heads、remotes和tags,heads中的檔案標識了專案中的各個分支指向的當前哪一個提交記錄index # 儲存暫存區資訊 ,在執行git init的時候 ,這個檔案還沒有(也就是暫存區的內容)

總結

git的安裝部署

git的初始化

git的相關檔案介紹

重點:如何安裝和設定git,如何初始化git及相關檔案作用

難點:記住git部署流程,記住這個目錄的作用及如何初始化

3分鐘瞭解計算機發展歷史-組團學