{"id":5900,"date":"2023-05-02T18:23:33","date_gmt":"2023-05-02T09:23:33","guid":{"rendered":"\/blog\/?p=5900"},"modified":"2024-02-08T13:09:24","modified_gmt":"2024-02-08T04:09:24","slug":"gitlab-ce","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=5900","title":{"rendered":"git \uc11c\ubc84 \uad6c\ucd95"},"content":{"rendered":"\n<span style=\"font-family: \ub098\ub214\uace0\ub515\ucf54\ub529, \ub3cb\uc6c0\uccb4, \uad74\ub9bc\uccb4, \uad81\uc11c\uccb4; font-size: 12pt;\">\u25a9STRING THAT NEEDS TO BE CHANGED:<br \/>&nbsp; <em>\/mnt\/scm\/git 10.10.10.111 scm sample_repo<\/em><br \/><br \/>\u25a0git \uc6d0\ub9ac \ubc0f \ub9e4\ucee4\ub2c8\uc998<br \/>&nbsp; <a href=\"https:\/\/git-scm.com\/book\/ko\/v2\/\" target=\"_blank\" rel=\"noopener\">https:\/\/git-scm.com\/book\/ko\/v2\/<\/a><br \/><br \/>###########################################################<br \/>#<br \/># SSH \ud504\ub85c\ud1a0\ucf5c\ub85c \uc6b4\uc601 \ubc29\ubc95 (\ucd94\ucc9c\ud558\uc9c0 \uc54a\uc74c)<br \/>#<br \/>###########################################################<br \/>1.\uc0ac\uc6a9\uc790 \uc0dd\uc131<br \/>&nbsp; GIT_REPO_DIR=\"\/mnt\/scm\/git\"<br \/>&nbsp; useradd -m -d ${GIT_REPO_DIR} -s \/usr\/bin\/git-shell -g scm -c \"Git User\" scm<br \/><br \/>2.SSH \uc778\uc99d\ud0a4 \uc0dd\uc131<br \/>&nbsp; GIT_REPO_DIR=\"\/mnt\/scm\/git\"<br \/>&nbsp; mkdir ${GIT_REPO_DIR}\/.ssh<br \/>&nbsp; ssh-keygen -b 2048 -t rsa -C \"git1@email.com\" -f ${GIT_REPO_DIR}\/.ssh\/id_rsa -q -P \"\"<br \/>&nbsp; cat ${GIT_REPO_DIR}\/.ssh\/id_rsa.pub &gt;&gt; ${GIT_REPO_DIR}\/.ssh\/authorized_keys<br \/>&nbsp; chown -R scm:scm ${GIT_REPO_DIR}<br \/><br \/>3.SSH \uac1c\uc778\ud0a4 PC\uc5d0 \uc124\uce58 (Windows)<br \/>&nbsp; MKDIR \"%USERPROFILE%\\.ssh\"<br \/>&nbsp; COPY \/Y id_rsa \"%USERPROFILE%\\.ssh\\\"<br \/>&nbsp; ECHO Host 10.10.10.111 &gt;\"%USERPROFILE%\\.ssh\\config\"<br \/>&nbsp; ECHO HostName 10.10.10.111 &gt;&gt;\"%USERPROFILE%\\.ssh\\config\"<br \/>&nbsp; ECHO User git &nbsp;&gt;&gt;\"%USERPROFILE%\\.ssh\\config\"<br \/>&nbsp; ECHO KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1 &gt;&gt;\"%USERPROFILE%\\.ssh\\config\"<br \/>&nbsp; ECHO PubkeyAcceptedAlgorithms +ssh-rsa &gt;&gt;\"%USERPROFILE%\\.ssh\\config\"<br \/>&nbsp; ECHO HostkeyAlgorithms +ssh-rsa &gt;&gt;\"%USERPROFILE%\\.ssh\\config\"<br \/><br \/>4.SSH \uc811\uc18d \ud14c\uc2a4\ud2b8 (Windows)<br \/>&nbsp; ssh scm@10.10.10.111<br \/>&nbsp; \u203b\uc624\ub958 \uc2dc \uc11c\ubc84\uc758 \ub514\ub809\ud1a0\ub9ac \ud37c\ubbf8\uc158 \uc810\uac80<br \/><br \/>5.git \ud14c\uc2a4\ud2b8 \uc800\uc7a5\uc18c \uc0dd\uc131<br \/>&nbsp; GIT_REPO_DIR=\"\/mnt\/scm\/git\"<br \/>&nbsp; git init --bare --shared ${GIT_REPO_DIR}\/sample_repo.git<br \/>&nbsp; chown -R scm:scm ${GIT_REPO_DIR}\/sample_repo.git<br \/><br \/>6.git \uc811\uc18d \ud14c\uc2a4\ud2b8 (Windows)<br \/>&nbsp; git config --global user.email \"git1@email.com\"<br \/>&nbsp; git config --global user.name \"\ud64d\uae38\ub3d9\"<br \/>&nbsp; git config --global http.sslVerify false<br \/>&nbsp; git config --global core.autocrlf false<br \/>&nbsp; git config --global init.defaultBranch master<br \/>&nbsp; git config --global core.protectNTFS false<br \/>&nbsp; git init<br \/>&nbsp; git config pull.rebase false<br \/>&nbsp; git remote rm origin<br \/>&nbsp; git remote add origin \"ssh:\/\/scm@10.10.10.111\/mnt\/scm\/git\/sample_repo.git\"<br \/><br \/>&nbsp; git fetch origin<br \/>&nbsp; git pull origin master --allow-unrelated-histories<br \/>&nbsp; git add .<br \/>&nbsp; git commit -m \"commit:test\"<br \/>&nbsp; git push origin master<br \/><br \/>###########################################################<br \/>#<br \/># HTTPS \ud504\ub85c\ud1a0\ucf5c\ub85c \uc6b4\uc601 \ubc29\ubc95<br \/># git+gitweb \uc11c\ubc84 \uad6c\ucd95<br \/>#<br \/>###########################################################<br \/>1.git \uc124\uce58<br \/>&nbsp; apt -y install git<br \/>&nbsp; git --version<br \/><br \/>2.gitweb \uc124\uce58<br \/>&nbsp; GIT_REPO_DIR=\"\/mnt\/scm\/git\"<br \/>&nbsp; apt -y install gitweb apache2 libapache2-mod-fcgid libcgi-session-perl<br \/>&nbsp; vi \/etc\/gitweb.conf<br \/>&nbsp; &nbsp; $projectroot \uc218\uc815 = ${GIT_REPO_DIR}<br \/>&nbsp; vi \/usr\/share\/gitweb\/gitweb.cgi<br \/>&nbsp; &nbsp; $projectroot \uc218\uc815 = ${GIT_REPO_DIR}<br \/>&nbsp; chown -R scm:scm \/usr\/share\/gitweb<br \/>&nbsp; a2enmod cgid mime alias<br \/>&nbsp; a2dismod mpm_event<br \/>&nbsp; a2enmod mpm_prefork<br \/>&nbsp; a2enmod cgi<br \/><br \/>3.apache2 \uc0ac\uc6a9\uc790 \uc0dd\uc131<br \/>&nbsp; htpasswd -b -c \"\/etc\/apache2\/git.passwd\" git git<br \/>&nbsp; chown -R scm:scm ${GIT_REPO_DIR}<br \/>&nbsp; chown scm:scm \"\/etc\/apache2\/git.passwd\"<br \/><br \/>4.git \ub808\ud30c\uc9c0\ud1a0\ub9ac \uc0dd\uc131<br \/>&nbsp; GIT_REPO_DIR=\"\/mnt\/scm\/git\"<br \/>&nbsp; mkdir -p ${GIT_REPO_DIR}<br \/>&nbsp; git init --bare --shared ${GIT_REPO_DIR}\/sample_repo.git<br \/>&nbsp; \uc124\uba85: git init\uc758 --bare \uc635\uc158\uc740 \uc774 \uc800\uc7a5\uc18c\uc5d0 working \ub514\ub809\ud1a0\ub9ac\ub97c \uc0dd\uc131\ud558\uc9c0 \uc54a\uaca0\ub2e4\ub294 \uc758\ubbf8.<br \/>&nbsp; &nbsp; &nbsp; &nbsp;(\uc77c\ubc18\uc801\uc778 git init\uc740 .git \uc774\ub77c\ub294 \ud3f4\ub354\uac00 \uc0dd\uc131\ub418\uc5b4 \uadf8 \uc548\uc5d0 repository\uac00 \ud615\uc131\ub418\ub294\ub370, \uc774 \uc635\uc158\uc744 \uc774\uc6a9\ud558\uba74 \ubc14\ub85c \uadf8 \ud3f4\ub354 \uc790\uccb4\uc5d0 repository\ub97c \ud615\uc131\ud55c\ub2e4)<br \/>&nbsp; &nbsp; &nbsp; &nbsp;\uc774\ub294 \uace7, \uc774 \uc800\uc7a5\uc18c\uc5d0\uc11c\ub294 \uc9c1\uc811\uc801\uc778 \uc791\uc5c5\uc744 \ud558\uc9c0 \uc54a\uaca0\ub2e4\ub294 \uc758\ubbf8.<br \/>&nbsp; &nbsp; &nbsp; &nbsp;--shared \uc635\uc158\uc740 \uc5ec\ub7ec \uc0ac\ub78c\ub4e4\uc774 \uc774 \uc11c\ubc84\uc5d0 \uc811\uc18d\ud558\uc5ec \uc791\uc5c5\ud560\ub54c \uadf8 \uad8c\ud55c\uc744 \uc790\ub3d9\uc73c\ub85c \ubd80\uc5ec\ud574 \uc8fc\uae30 \uc704\ud55c \uc635\uc158<br \/><br \/>5. apache2 \uc124\uc815 \ucd94\uac00<br \/>&nbsp; vi \/etc\/apache2\/sites-available\/git-https.conf<br \/>------------------------------------------------------------<br \/>&lt;IfModule mod_ssl.c&gt;<br \/>&nbsp; &lt;VirtualHost _default_:443&gt;<br \/>&nbsp; &nbsp; ServerAdmin admin@localhost<br \/>&nbsp; &nbsp; DocumentRoot \"\/usr\/share\/gitweb\"<br \/>&nbsp; &nbsp; ErrorLog ${APACHE_LOG_DIR}\/error.log<br \/>&nbsp; &nbsp; CustomLog ${APACHE_LOG_DIR}\/access.log combined<br \/>&nbsp; &nbsp; &lt;Directory \"\/usr\/share\/gitweb\"&gt;<br \/>&nbsp; &nbsp; &nbsp; Options Indexes FollowSymLinks MultiViews ExecCGI<br \/>&nbsp; &nbsp; &nbsp; AddHandler cgi-script .cgi<br \/>&nbsp; &nbsp; &nbsp; DirectoryIndex gitweb.cgi<br \/>&nbsp; &nbsp; &nbsp; AllowOverride FileInfo AuthConfig Limit<br \/>&nbsp; &nbsp; &nbsp; Order Deny,Allow<br \/>&nbsp; &nbsp; &nbsp; Allow from all<br \/>&nbsp; &nbsp; &nbsp; Require all granted<br \/>&nbsp; &nbsp; &lt;\/Directory&gt;<br \/><br \/>&nbsp; &nbsp; SetEnv GIT_PROJECT_ROOT \"\/mnt\/scm\/git\"<br \/>&nbsp; &nbsp; SetEnv GIT_HTTP_EXPORT_ALL<br \/>&nbsp; &nbsp; SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER<br \/><br \/>&nbsp; &nbsp; # git\uacfc gitweb \ubaa8\ub450 \uac19\uc740 \ud3ec\ud2b8\ub85c \uc0ac\uc6a9\ud558\uae30 \uc704\ud55c \uc14b\ud305<br \/>&nbsp; &nbsp; ScriptAliasMatch \"(?x)^\/(.*\/(HEAD | \\<br \/>&nbsp; &nbsp; &nbsp; info\/refs | \\<br \/>&nbsp; &nbsp; &nbsp; objects\/(info\/[^\/]+ | \\<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [0-9a-f]{2}\/[0-9a-f]{38} | \\<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pack\/pack-[0-9a-f]{40}\\.(pack|idx)) | \\<br \/>&nbsp; &nbsp; &nbsp; git-(upload|receive)-pack))$\" \/usr\/lib\/git-core\/git-http-backend\/$1<br \/><br \/>&nbsp; &nbsp; AliasMatch ^\/git\/(.*\/objects\/[0-9a-f]{2}\/[0-9a-f]{38})$ \/usr\/share\/gitweb\/$1<br \/>&nbsp; &nbsp; AliasMatch ^\/git\/(.*\/objects\/pack\/pack-[0-9a-f]{40}.(pack|idx))$ \/usr\/share\/gitweb\/$1<br \/>&nbsp; &nbsp; ScriptAlias \u200b\u200b\/git\/ \/usr\/lib\/git-core\/git-http-backend<br \/><br \/>&nbsp; &nbsp; &lt;Location \/&gt;<br \/>&nbsp; &nbsp; &nbsp; AllowOverride All<br \/>&nbsp; &nbsp; &nbsp; Options All<br \/>&nbsp; &nbsp; &nbsp; AuthType Basic<br \/>&nbsp; &nbsp; &nbsp; AuthName \"Restricted Content\"<br \/>&nbsp; &nbsp; &nbsp; AuthUserFile \"\/etc\/apache2\/git.passwd\"<br \/>&nbsp; &nbsp; &nbsp; Require valid-user<br \/>&nbsp; &nbsp; &lt;\/Location&gt;<br \/><br \/>&nbsp; &nbsp; SSLEngine on<br \/>&nbsp; &nbsp; SSLCertificateFile \/etc\/apache2\/ssl\/certs\/ssl-cert-scm.crt<br \/>&nbsp; &nbsp; SSLCertificateKeyFile \/etc\/apache2\/ssl\/private\/ssl-cert-scm.key<br \/>&nbsp; &nbsp; &lt;FilesMatch \"\\.(cgi|shtml|phtml|php)$\"&gt;<br \/>&nbsp; &nbsp; &nbsp; SSLOptions +StdEnvVars<br \/>&nbsp; &nbsp; &lt;\/FilesMatch&gt;<br \/>&nbsp; &nbsp; &lt;Directory \/usr\/lib\/cgi-bin&gt;<br \/>&nbsp; &nbsp; &nbsp; SSLOptions +StdEnvVars<br \/>&nbsp; &nbsp; &lt;\/Directory&gt;<br \/>&nbsp; &lt;\/VirtualHost&gt;<br \/>&lt;\/IfModule&gt;<br \/>------------------------------------------------------------<br \/><br \/>6. apache2 \ubaa8\ub4c8 \uc14b\ud305 \ubc0f \uc7ac\uc2dc\uc791<br \/>&nbsp; a2dissite scm-http.conf<br \/>&nbsp; a2dissite scm-https.conf<br \/>&nbsp; a2ensite scm-webdav.conf<br \/>&nbsp; a2ensite git-https.conf<br \/>&nbsp; systemctl enable apache2<br \/>&nbsp; systemctl restart apache2<br \/>&nbsp; &gt;&gt; https:\/\/10.10.10.111 \uc73c\ub85c \ud655\uc778<br \/><br \/>7.git \uc811\uc18d \ud14c\uc2a4\ud2b8 (Windows)<br \/>&nbsp; git config --global core.autocrlf false<br \/>&nbsp; git config --global core.protectNTFS false<br \/>&nbsp; git config --global http.sslVerify false<br \/>&nbsp; git config --global init.defaultBranch master<br \/>&nbsp; git config --global user.email \"git1@email.com\"<br \/>&nbsp; git config --global user.name \"\ud64d\uae38\ub3d9\"<br \/>&nbsp; git init<br \/>&nbsp; git config pull.rebase false<br \/>&nbsp; git remote rm origin<br \/>&nbsp; git remote add origin \"https:\/\/git:scm@10.10.10.111\/sample_repo.git\"<br \/><br \/>&nbsp; git fetch origin<br \/>&nbsp; git pull origin master --allow-unrelated-histories<br \/>&nbsp; git add .<br \/>&nbsp; git commit -m \"commit:test\"<br \/>&nbsp; git push origin master<br \/><\/span>\n","protected":false},"excerpt":{"rendered":"<p>\u25a9STRING THAT NEEDS TO BE CHANGED:&nbsp; \/mnt\/scm\/git 10.10.10.111 scm sample_repo \u25a0git \uc6d0\ub9ac \ubc0f \ub9e4\ucee4\ub2c8\uc998&nbsp; https:\/\/git-scm.com\/book\/ko\/v2\/ ############################################################# SSH \ud504\ub85c\ud1a0\ucf5c\ub85c \uc6b4\uc601 \ubc29\ubc95 (\ucd94\ucc9c\ud558\uc9c0 \uc54a\uc74c)############################################################1.\uc0ac\uc6a9\uc790 \uc0dd\uc131&nbsp; GIT_REPO_DIR=&#8221;\/mnt\/scm\/git&#8221;&nbsp; useradd -m -d ${GIT_REPO_DIR} -s \/usr\/bin\/git-shell -g scm -c &#8220;Git User&#8221; scm 2.SSH \uc778\uc99d\ud0a4 \uc0dd\uc131&nbsp; GIT_REPO_DIR=&#8221;\/mnt\/scm\/git&#8221;&nbsp; mkdir ${GIT_REPO_DIR}\/.ssh&nbsp; ssh-keygen -b 2048 -t rsa -C &#8220;git1@email.com&#8221; -f ${GIT_REPO_DIR}\/.ssh\/id_rsa -q -P &#8220;&#8221;&nbsp; cat [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[15],"tags":[],"class_list":["post-5900","post","type-post","status-publish","format-standard","hentry","category-computing_tools"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5900","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5900"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5900\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}