linux上にgit倉庫を構築する2019-05-21
3726 ワード
Gitはオープンソースの分散バージョン制御システムであり、非常に小さなプロジェクトバージョンから非常に大きなプロジェクトバージョン管理を効率的かつ高速に処理するために使用されます.GitはLinus TorvaldsがLinuxカーネル開発の管理を支援するために開発したオープンソースのバージョン制御ソフトウェアである.
gitローカルウェアハウスを構築し、可用性をテストします.
-centos7 -git
gitサービスのインストール:
git作業ディレクトリを作成するには、次の手順に従います.
プロジェクトgit_の作成プロジェクトを初期化し、倉庫を初期化します.
現在のディレクトリの内容をキャッシュに追加するには、次の手順に従います.
gitユーザーの設定:
変更をローカル・ウェアハウスに送信するには、次の手順に従います.
フォーマット:git commit-m「今回提出した説明」
すべてのコミットを表示:
ローカル・ウェアハウスが正常に稼働しているかどうかを確認するには、ローカル・ウェアハウスをリモート・ウェアハウスに追加し、引き出しテストを行う必要があります.
リモート・ウェアハウスとしてローカル・ウェアハウスを追加するには、次の手順に従います.
originリモートウェアハウスを追加します.アドレスはネイティブgit_です.プロジェクト下の倉庫
ローカルライブラリのコンテンツをリモートライブラリにコミットするには、次の手順に従います.
フォーマット:git push、リモートブランチ名が省略されている場合、追跡関係に基づいて同名ブランチまたは新規ブランチをプッシュします.
リモート・ウェアハウスからの引き出し:
成功しました.
ターゲット:
gitローカルウェアハウスを構築し、可用性をテストします.
準備:
-centos7 -git
プロセス:
gitサービスのインストール:
[root@controller ~]# yum -y install git
git作業ディレクトリを作成するには、次の手順に従います.
[root@controller ~]# mkdir test_git
プロジェクトgit_の作成プロジェクトを初期化し、倉庫を初期化します.
[root@controller ~]# cd test_git/
[root@controller test_git]# git init --bare git_project
Initialized empty Git repository in /root/test_git/git_project/
[root@controller test_git]# cd git_project/
[root@controller git_project]# git init
Initialized empty Git repository in /root/test_git/git_project/.git/
現在のディレクトリの内容をキャッシュに追加するには、次の手順に従います.
[root@controller git_project]# pwd
/root/test_git/git_project
[root@controller git_project]# echo "test_git" > readme.txt
[root@controller git_project]# git add .
gitユーザーの設定:
[root@controller git_project]# git config --global user.email "[email protected]"
[root@controller git_project]# git config --global user.name "Your Name"
変更をローカル・ウェアハウスに送信するには、次の手順に従います.
フォーマット:git commit-m「今回提出した説明」
[root@controller git_project]# git commit -m "test_git"
[master (root-commit) 082e956] test_git
14 files changed, 510 insertions(+)
create mode 100644 HEAD
create mode 100644 config
create mode 100644 description
create mode 100755 hooks/applypatch-msg.sample
create mode 100755 hooks/commit-msg.sample
create mode 100755 hooks/post-update.sample
create mode 100755 hooks/pre-applypatch.sample
create mode 100755 hooks/pre-commit.sample
create mode 100644 hooks/pre-push.sample
create mode 100755 hooks/pre-rebase.sample
create mode 100755 hooks/prepare-commit-msg.sample
create mode 100755 hooks/update.sample
create mode 100644 info/exclude
create mode 100644 readme.txt
すべてのコミットを表示:
[root@controller git_project]# git log
commit 082e956478fc4476d2e90f3ab179cc94425e53e1
Author: Your Name
Date: Wed May 22 04:21:54 2019 -0400
test_git
テスト:
ローカル・ウェアハウスが正常に稼働しているかどうかを確認するには、ローカル・ウェアハウスをリモート・ウェアハウスに追加し、引き出しテストを行う必要があります.
リモート・ウェアハウスとしてローカル・ウェアハウスを追加するには、次の手順に従います.
originリモートウェアハウスを追加します.アドレスはネイティブgit_です.プロジェクト下の倉庫
[root@controller git_project]# git remote add origin 192.168.100.20:/root/test_git/git_project/
ローカルライブラリのコンテンツをリモートライブラリにコミットするには、次の手順に従います.
フォーマット:git push、リモートブランチ名が省略されている場合、追跡関係に基づいて同名ブランチまたは新規ブランチをプッシュします.
[root@controller git_project]# git push origin master
The authenticity of host '192.168.100.20 (192.168.100.20)' can't be established.
ECDSA key fingerprint is f2:e8:0f:d6:bf:c8:e1:70:0d:d1:8a:47:15:4a:41:7e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.100.20' (ECDSA) to the list of known hosts.
[email protected]'s password:
Everything up-to-date
リモート・ウェアハウスからの引き出し:
[root@controller ~]# mkdir test
[root@controller ~]# cd test
[root@controller test]# git clone 192.168.100.20:/root/test_git/git_project/
Cloning into 'git_project'...
[email protected]'s password:
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 18 (delta 1), reused 0 (delta 0)
Receiving objects: 100% (18/18), 7.39 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1/1), done.
成功しました.