×ðÁú¿­Ê±¹ÙÍøµÇ¼

UbuntuϵͳÉÏÔõôװÖúÍʹÓÃgitlab

Ò»¡¢Ç°ÑÔ

Ìá¼° Git £¬Ðí¶à³ÌÐòÔ±ÃǶ¼ÖªµÀ¡£¶ø GitLab ÔòÊÇÒ»¸ö»ùÓÚ Git µÄ¿ªÔ´Æ½Ì¨ £¬Ö¼ÔÚΪÍŶÓÌṩ´úÂëÍйܡ¢°æ±¾ÖÎÀí¡¢×Ô¶¯»¯²âÊÔ¡¢CI/CD µÈһϵÁÐЧÀÍ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚ Ubuntu ϵͳÉÏ×°Öà GitLab ²¢¾ÙÐлù±¾Ê¹Óá£

¶þ¡¢×°ÖÃ GitLab

×°ÖÃÒÀÀµÏî

ÔÚ×°Öà GitLab Ç° £¬ÐèҪװÖúÃһЩÒÀÀµÏî¡£ÔÚÖÕ¶ËÖÐÊäÈëÒÔÏÂÏÂÁ

sudo apt update
sudo apt install -y curl openssh-server ca-certificates tzdata perl

µÇ¼ºó¸´ÖÆ

Ìí¼Ó GitLab GPG ÃÜÔ¿

±à¼­ /etc/apt/sources.list.d/gitlab-ce.list Îļþ £¬²¢Ð´ÈëÒÔÏÂÄÚÈÝ£º

deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu bionic main

µÇ¼ºó¸´ÖÆ

ÉúÑIJ¢Í˳öÎļþ £¬È»ºóÊäÈëÒÔÏÂÏÂÁ

curl https://packages.gitlab.com/gpg.key | sudo apt-key add -

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁÌí¼Ó GitLab GPG ÃÜÔ¿¡£

×°ÖÃ GitLab CE

ÊäÈëÒÔÏÂÏÂÁî×°Öà GitLab£º

sudo apt update
sudo apt install -y gitlab-ce

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó £¬ÊäÈëÒÔÏÂÏÂÁîÆô¶¯ GitLab£º

sudo gitlab-ctl reconfigure

µÇ¼ºó¸´ÖÆ

ÔÚÕû¸öÀú³ÌÖÐ £¬ÐèÒªÆÚ´ýÒ»¶Îʱ¼ä¡£Ò»µ© reconfigure Íê±Ï £¬GitLab ½«»áÆô¶¯¡£ÔÚä¯ÀÀÆ÷Öлá¼ûЧÀÍÆ÷ IP µØµã»òÓòÃû£ºhttp://SERVER_IP_OR_DOMAIN £¬Õâ¸öʱ¼ä½«¿´µ½ GitLab µÄ½Ó´ýÒ³Ãæ £¬ÌåÏÖÒÑ×°ÖÃÀֳɡ£

Èý¡¢Ê¹Óà GitLab

¾­ÓÉÉÏÃæµÄ°ì·¨ £¬GitLab ÒѾ­×°ÖÃÀÖ³ÉÁË £¬ÏÂÃ潫¼òÆÓÏÈÈÝÔõÑù¾ÙÐÐ GitLab µÄ»ù±¾Ê¹Óá£

½¨ÉèÒ»¸öÐÂÏîÄ¿

Ê×ÏÈ £¬ÔÚ GitLab Öн¨ÉèÒ»¸öÐÂÏîÄ¿¡£µÇ¼ GitLab ºó £¬µã»÷×ó²à²Ëµ¥À¸Öеġ°Ð½¨ÏîÄ¿¡± £¬½øÈ롰н¨ÏîÄ¿¡±Ò³Ãæ¡£ÔÚ¸ÃÒ³ÃæÖÐ £¬ÌîдÏîÄ¿Ãû³Æ¡¢ÏîÄ¿ÐÎò £¬È»ºóµã»÷¡°½¨ÉèÏîÄ¿¡±°´Å¥¼´¿É¡£

¿Ë¡ÏîÄ¿

¿Ë¡ÏîÄ¿ÊÇÖ¸½«Ô¶³Ì Git ¿ÍÕ»ÖеĴúÂ븴ÖƵ½ÍâµØ¿ª·¢»úеÉÏ¡£ÔÚ GitLab ÖÐ £¬ÓÐÁ½ÖÖ¿Ë¡ÏîÄ¿µÄ·½·¨£º

HTTP/HTTPS ·½·¨ £¬Ê¹Óø÷½·¨¿Éͨ¹ý https À´À­È¡´úÂë £¬ÀýÈ磺

git clone https://gitlab.com/<user>/<project>.git</project></user>

µÇ¼ºó¸´ÖÆ

SSH ·½·¨ £¬Ê¹Óø÷½·¨ÐèÒªÔÚ GitLab ÖÐÌìÉú SSH ÃÜÔ¿ £¬È»ºó½« SSH ÃÜÔ¿Ìí¼Óµ½ÍâµØ»úеÖС£ÀýÈ磺

git clone git@gitlab.com:<user>/<project>.git</project></user>

µÇ¼ºó¸´ÖÆ

½¨Éè·ÖÖ§

ÔÚ GitLab ÖÐ £¬¿ÉÒÔ½¨Éè¶à¸ö·ÖÖ§ÒԱ㿪·¢Ö°Ô±ÃǸüºÃµØÏàÖú¿ª·¢¡£ÔÚ GitLab ÖÐ £¬¿ÉÒÔ½¨ÉèеķÖÖ§²¢½«´úÂëÍÆË͵½¸Ã·ÖÖ§ÉÏ¡£ÔÚÏîÄ¿Ò³ÃæÖÐ £¬µã»÷¡°·ÖÖ§¡±°´Å¥ £¬È»ºóÊäÈëÒª½¨ÉèµÄ·ÖÖ§Ãû³ÆºÍÐÎò £¬×îºóµã»÷¡°½¨Éè·ÖÖ§¡±°´Å¥¼´¿É¡£

Ìá½»½ÓÂë

ÔÚ¿ª·¢ÖÐ £¬Ã¿´ÎÐ޸ĺó¶¼ÐèÒªÌá½»½ÓÂë¡£ÔÚ GitLab ÖÐ £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÏòÔ¶³Ì¿ÍÕ»Ìá½»½ÓÂ룺

git add .
git commit -m "commit message"
git push origin master

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÏÂÁÏòÔ¶³Ì Git ¿ÍÕ»µÄ master ·ÖÖ§ÍÆËÍ´úÂë¡£

½¨Éè Merge Request

ÔÚ GitLab ÖÐ £¬¿ÉÒÔ½¨Éè Merge Request ÒÔ±ã¾ÙÐдúÂëÉó²éºÍºÏ²¢¡£ÔÚÏîÄ¿Ò³ÃæÖÐ £¬µã»÷¡°Merge Request¡±°´Å¥ £¬È»ºóÊäÈëÆúÏÇëÇóÃû³ÆºÍÐÎò £¬×îºóµã»÷¡°Ìá½»Merge Request¡±°´Å¥¼´¿É¡£

CD/CI

GitLab »¹ÌṩÁË CD/CI µÈ×Ô¶¯»¯¹¦Ð§ £¬Ê¹ÓÃÕß¿ÉÒÔÔÚ GitLab Öн¨Éè Pipeline £¬¶ÔÏîÄ¿¾ÙÐÐÒ»Á¬¼¯³ÉºÍÒ»Á¬°²ÅÅ¡£

ËÄ¡¢×ܽá

±¾ÎÄÏÈÈÝÁËÔõÑùÔÚ Ubuntu ϵͳÉÏ×°Öà GitLab £¬²¢¼òÆÓÏÈÈÝÁË GitLab µÄ»ù±¾Ê¹Óá£ËäÈ» £¬ÔÚÏÖʵӦÓõ±ÖÐ £¬GitLab µÄ¹¦Ð§ÉÐÓÐÐí¶à £¬¶ÁÕß¿ÉÒÔÍŽáÏÖʵÐèÇóȥ̽Ë÷ GitLab ¸ü¶àµÄÌØÕ÷¡£

ÒÔÉϾÍÊÇUbuntuϵͳÉÏÔõôװÖúÍʹÓÃgitlabµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ