Git学習ノート(一)---Gitのインストールと構成


Gitのインストールと構成


一、Linuxの下にGitを取り付ける


Linuxでgitがインストールされているかどうかを判断し、入力コマンドgitは以下の情報を見てgitがインストールされていないことを説明します.
[yunns@bogon Desktop]$ git
bash: git: command not found...

1、gitをダウンロードし、ヒントに従って次のステップに進み、インストールを完了すればよい.(yumはrootユーザーの下で使用することに注意)
[yunns@bogon Desktop]# yum install git
...
...
Installed:
  git.x86_64 0:1.8.3.1-6.el7_2.1                                                
  
Dependency Installed:
  perl-Error.noarch 1:0.17020-2.el7       perl-Git.noarch 0:1.8.3.1-6.el7_2.1  
  perl-TermReadKey.x86_64 0:2.30-20.el7  

Complete!

2、gitバージョンの表示
[root@bogon Desktop]# git --version
git version 1.8.3.1

二、配置Git


gitのインストールが完了したら、あなたの情報を構成する必要があります.
[root@bogon Desktop]# git config --global user.name "yunns"
[root@bogon Desktop]# git config --global user.email "[email protected]"

三、バージョンライブラリの作成


1、新規フォルダgit-repository
[root@bogon Desktop]# mkdir git-repository

2、git倉庫の初期化
[root@bogon git-repository]# git init
Initialized empty Git repository in /home/yunns/Desktop/git-repository/.git/

Initialized empty Git repository in/home/yunns/Desktop/git-repositroy/.git/
/home/yunns/desktop/git-repository/場所でgitの倉庫を作成し、ls-ahで表示できることを示します.gitファイル
[root@bogon git-repository]# ls -ah
.  ..  .git

四、git倉庫にファイルを追加するテスト
1、新規ファイルreadme.txt
[root@bogon git-repository]# vi readme.txt
Git is a free and open source version control system.

2、コマンドgit addを使用して倉庫にファイルを追加する(git addの複数のファイルまたはフォルダを倉庫に追加し、一緒に提出することができる)
[root@bogon git-repository]# git add readme.txt

3、コマンドgit commitを使ってファイルを提出し、-m後にあなたの提出情報を追加することができます
[root@bogon git-repository]# git commit -m"2016-03-26 20:34 submit 2files for yunns"
[master (root-commit) fc06f54] 2016-03-26 20:34 submit 2files for yunns
 1 file changed, 2 insertions(+)
 create mode 100644 readme.txt

はい、今日のノートはここまでで、私も初心者で、足りないところがあったら先輩によろしくお願いします!