ÔõÑù´î½¨×Ô¼ºµÄGitlab¿â
½ñÌ죬ÎÒÃÇÀ´ÏÈÈÝһϹØÓÚÔõÑù´î½¨gitlab¿âµÄÒªÁì¡£gitlabÊÇ×îÊܽӴýµÄ×ÔÍйܵÄgit´æ´¢¿â¡£gitÊÇÒ»¸ö°æ±¾¿ØÖƹ¤¾ß£¬ÓÃÓڼͼºÍ×·ËÝÎļþµÄ¸ü¸Ä¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«Ò»²½²½ÏòÄúÏÈÈÝÔõÑù´î½¨×Ô¼ºµÄgitlab¿â¡£
µÚÒ»²½£º×°ÖÃÐëÒªµÄÈí¼þ°ü
Òª´î½¨×Ô¼ºµÄGitlab¿â£¬Ê×ÏÈÐèҪװÖÃGitlabËùÐèµÄһЩÈí¼þ°ü¡£°üÀ¨Redis¡¢PostgreSQL¡¢OpenSSH Server¡¢ca-certificatesµÈ¡£Äú¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´×°ÖÃËùÐèµÄÈí¼þ°ü£º
sudo apt-get install curl openssh-server ca-certificates postfix
µÚ¶þ²½£º×°ÖÃGitlab
½Ó×Å£¬ÎÒÃÇÀ´×°ÖÃGitlabÈí¼þ¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«×°ÖÃGitlabÉçÇø°æ¡£Äú¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´×°ÖÃGitlab£º
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce
µÇ¼ºó¸´ÖÆ
µÚÈý²½£ºÉèÖÃGitlab
×°ÖÃGitlabÖ®ºó£¬ÎÒÃÇÐèÒª¶ÔÆä¾ÙÐÐÉèÖᣠÊ×ÏÈ£¬ÄúÐèÒªÉèÖÃGitlabµÄÍⲿURL¡£ ÔÚGitlabµÄÉèÖÃÎļþÖУ¨/etc/gitlab/gitlab.rb£©£¬Äú¿ÉÒÔÕÒµ½ÒÔÏÂÄÚÈÝ£º
# gitlab_rails['gitlab_ssh_host'] = 'ssh.host_example.com' # gitlab_rails['time_zone'] = 'UTC' # ¡
µÇ¼ºó¸´ÖÆ
½«ÆäÖеġ°gitlab_ssh_host¡±ÉèÖÃΪÄúµÄÍⲿURL¡£ ²»ÐèÒªÉèÖÃʱ¼äÇøÓò£¬³ý·ÇÄúÏëÖ¸¶¨ÍâµØʱ¼ä¡£
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÖØÐÂÉèÖÃGitlab£º
sudo gitlab-ctl reconfigure
µÚËIJ½£ºÊ¹ÓÃGitlab
ÏÖÔÚ£¬ÄúÒѾÍê³ÉÁËGitlabµÄ×°ÖúÍÉèÖᣠÄú¿ÉÒÔͨ¹ýÒÔÏÂURLÀ´»á¼ûGitlab£ºhttp://localhost»òhttp://your_server_ip¡£ Ö»ÐèÊäÈëÄúµÄÓû§ÃûºÍÃÜÂ룬¾Í¿ÉÒÔ»á¼ûÄúµÄGitlab¿â¡£
µÚÎå²½£º½¨ÉèGitlab¿â
ÓÐÁ½ÖÖÒªÁì¿ÉÒÔ½¨ÉèGitlab¿â¡£ µÚÒ»ÖÖÒªÁìÊÇ´ÓGitlabµÄWeb½çÃ潨Éè¿â¡£ ÄúÖ»ÐèµÇ¼µ½Gitlab£¬µ¥»÷¡°New project¡±°´Å¥¡£ È»ºó£¬ÌîдÓйØÄúµÄÏîÄ¿µÄÐÅÏ¢£¬È»ºóµ¥»÷¡°Create project¡±¡£
µÚ¶þÖÖÒªÁìÊÇʹÓÃGitÏÂÁî¡£ ÈôÊÇÄúÔÚÍâµØÅÌËã»úÉÏʹÓÃGit£¬¿ÉÒÔ½«ÄúµÄÏîÄ¿ÍÆË͵½Gitlab¿â¡£ ÒÔÏÂÊǽ¨ÉèGitlab¿â²¢½«ÍâµØÏîÄ¿ÍÆË͵½Ð½¨ÉèµÄ¿âµÄÏÂÁî¡£
# ½¨ÉèÐÂÏîÄ¿ curl -X POST -d "name=my_project&visibility_level=20" --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects # ½«ÏÖÓÐÏîÄ¿ÍÆË͵½Gitlab¿â cd my_project/ git remote add origin git@gitlab.example.com:<your_username>/my_project.git git push -u origin master</your_username></your_access_token>
µÇ¼ºó¸´ÖÆ
ʹÓÃÉÏÊöÒªÁ죬Äú¾Í¿ÉÒÔÇáËɵش×Ô¼ºµÄGitlab¿â£¬ÏíÊÜ°æ±¾¿ØÖƵÄÐËȤ¡£
ÒÔÉϾÍÊÇÔõÑù´î½¨×Ô¼ºµÄGitlab¿âµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡