{"id":23662,"date":"2022-11-05T12:59:38","date_gmt":"2022-11-05T04:59:38","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=23662"},"modified":"2022-11-05T12:59:39","modified_gmt":"2022-11-05T04:59:39","slug":"ubuntu-git-server","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-git-server.html","title":{"rendered":"Ubuntu16.04\u6700\u5feb\u6377\u642d\u5efa\u5c0f\u578b\u5c40\u57df\u7f51Git\u670d\u52a1\u5668"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u4f7f\u7528linux\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4e0d\u5f97\u4e0d\u63d0Git\u7248\u672c\u7ba1\u7406\u5668\uff0c\u8fd9\u4e2aLinus\u82b1\u4e86\u4e24\u5468\u65f6\u95f4\u5f00\u53d1\u7684\u5206\u5e03\u5f0f\u7248\u672c\u7ba1\u7406\u5668\uff08\u8fd9\u5c31\u662f\u5927\u795e\uff0c\u5148\u819c\u4e86\u4e2a\u62dc\u3002\u3002\u3002\uff09\uff0c\u6beb\u65e0\u7591\u95ee\uff0cGit\u7248\u672c\u7ba1\u7406\u5668\u4e0elinux\u7cfb\u7edf\u6709\u7740\u4e0e\u751f\u4ff1\u6765\u7684\u540c\u4e00\u8840\u7f18\uff0c\u6545\u800c\u5176\u5728linux\u4e0a\u7684\u8868\u73b0\u4e5f\u662f\u5982\u9c7c\u5f97\u6c34\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u90a3\u4e48\u5728linux\u4e0a\u9762\u7ba1\u7406\u6587\u6863\u3001\u7a0b\u5e8f\u3001\u6e90\u7801\u7b49\u6587\u4ef6\u6700\u597d\u7684\u5c31\u662fGit\u4e86\uff0c\u800c\u4e14Git\u662f\u5206\u5e03\u5f0f\uff0c\u4e0d\u5fc5\u4e0e\u4e2d\u5fc3\u670d\u52a1\u5668\u901a\u8baf\u5373\u53ef\u7ba1\u7406\u672c\u5730\u7248\u672c\u3002\u7136\u800c\uff0c\u5bf9\u4e8e\u4e00\u4e2a\u534f\u540c\u5de5\u4f5c\u7684\u5c0f\u578b\u56e2\u961f\u6765\u8bf4\uff0c\u4ec5\u9760\u672c\u5730\u7248\u672c\u7ba1\u7406\u662f\u4e25\u91cd\u4e0d\u591f\u7684\uff0c\u5fc5\u987b\u901a\u8fc7\u4fe1\u606f\u4ea4\u4e92\u4f7f\u56e2\u961f\u7684\u7248\u672c\u4fdd\u6301\u4e00\u81f4\uff0c\u65b9\u53ef\u786e\u4fdd\u56e2\u961f\u7684\u65b9\u5411\u4e00\u81f4\u3002\u800c\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u5c31\u662f\u642d\u5efa\u4e00\u4e2a\u5c40\u57df\u7f51\u7684\u670d\u52a1\u5668\u3002\u4ee5\u4e0b\u662f\u6211\u5728Ubuntu16.04\u4e0a\u9762\u642d\u5efa\u7684\u5c0f\u578b\u5c40\u57df\u7f51\u670d\u52a1\u5668\uff0c\u5728\u5c40\u57df\u7f51\u5185\u5bf9\u56e2\u961f\u7684\u7a0b\u5e8f\u6e90\u7801\u505a\u7248\u672c\u7ba1\u7406\uff0c\u8f6f\u4ef6\u5f00\u53d1\u5219\u5728\u5176\u4e0a\u865a\u62df\u7684Windows\u4e0a\u8fdb\u884c\uff0c\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u670d\u52a1\u5668\u642d\u5efa\u540e\uff0c\u4e0d\u8bbaUbuntu\u6216Windows\u5747\u53ef\u6b63\u5e38\u8fdb\u884c\u7248\u672c\u7ba1\u7406\u3002<\/p>\n

\u4e0b\u9762\u4ecb\u7ecd\u642d\u5efa\u8fc7\u7a0b\uff1a<\/p>\n

\u66f4\u65b0apt-get<\/strong><\/div>\n
Sudo apt-get update<\/pre>\n
\u5b89\u88c5Git\uff08\u90e8\u5206\u7248\u672c\u5df2\u9ed8\u8ba4\u5b89\u88c5\uff09<\/strong><\/div>\n
Sudo apt-get install git<\/pre>\n

\u7136\u540e\u5728\u8be2\u95ee\u65f6\uff0c\u8f93\u5165\u201cy\u201d\uff0c\u56de\u8f66<\/p>\n

\"git-01\"<\/p>\n

\u521b\u5efagit\u7ba1\u7406\u5458\u8d26\u6237<\/strong><\/div>\n
sudo adduser git<\/pre>\n

\u7136\u540e\u8f93\u5165\u6b64\u7528\u6237\u7684\u5bc6\u7801\u5e76\u518d\u6b21\u786e\u8ba4\u5bc6\u7801\uff0c\u5176\u4f59\u9009\u9879\u5747\u56de\u8f66\u9ed8\u8ba4\u5373\u53ef<\/p>\n

\"git-02\"<\/p>\n

\u521b\u5efa\u4ed3\u5e93<\/strong><\/div>\n

\u8fdb\u5165srv\u6587\u4ef6\u5939\uff0c\u5728\u53f3\u952e\u83dc\u5355\u5185\u9009\u62e9\u201c\u5728\u7ec8\u7aef\u6253\u5f00\u201d\u9009\u9879<\/p>\n

\u521d\u59cb\u5316\u4ed3\u5e93<\/p>\n

Sudo git init --bare MyProject.git<\/pre>\n

(\u6b64\u5904\u4e3a\u4e24\u4e2a-)<\/strong><\/p>\n

\u547d\u4ee4\u7ed3\u675f\u540e\uff0c\u4f1a\u5728MyProject.git\u5185\u521b\u5efa\u4ee5\u4e0b\u6587\u4ef6<\/p>\n

\"git-03\"<\/p>\n

\u5728srv\u76ee\u5f55\u4e0b\uff0c\u66f4\u6539MyProject.git\u7684\u6240\u6709\u6743<\/strong><\/div>\n
sudo chown -R git:git MyProject.git<\/pre>\n

\u81f3\u6b64\uff0c\u4e00\u4e2a\u6ca1\u6709\u6743\u9650\u9650\u5236\u7684\u5c40\u57df\u7f51Git\u670d\u52a1\u5668\u642d\u5efa\u5b8c\u6bd5\u3002<\/p>\n

\u9a8c\u8bc1<\/strong><\/div>\n

\u5728hone\u4e0b\uff0c\u542f\u52a8\u547d\u4ee4\u7ec8\u7aef\uff0c\u8f93\u5165\u201csudo git clone git@192.168.1.109:\/srv\/MyProject.git\u201d,\u5176\u4e2d\u7684IP\u5730\u5740\u4e3aUbuntu\u7684ip\u5730\u5740<\/p>\n

\u56de\u8f66\u5373\u53ef\uff0c\u5728home\u4e0b\u4f1a\u51fa\u73b0\u4e00\u4e2aMyProject.git\u7684\u7a7a\u6587\u4ef6\u5939<\/p>\n

\"git-04\"<\/p>\n

\u82e5\u6ca1\u6709clone\u6210\u529f\uff0c\u800c\u662f\u51fa\u73b0\u4e86\u4ee5\u4e0b\u60c5\u51b5<\/p>\n

\"git-05\"<\/p>\n

\u90a3\u4e48\u9700\u8981\u5728Ubuntu\u4e0a\u5b89\u88c5ssh<\/p>\n

\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\uff1a<\/p>\n

sudo apt-get installopenssh-client<\/pre>\n

\u6211\u5e73\u65f6\u5728windows\u4e0b\u5de5\u4f5c\uff0c\u90a3\u4e48\u8fd9\u91cc\u6211\u5c31\u7528Windows\u9a8c\u8bc1\u4e00\u4e0b\u670d\u52a1\u5668\u662f\u5426\u53ef\u4ee5\u4f7f\u7528\u3002<\/p>\n

\u9996\u5148\u5b89\u88c5git\uff0c\u767e\u5ea6\u641c\u7d22\u4e0b\u8f7d\u5e94\u7528\u7a0b\u5e8f\uff0c\u7136\u540e\u5b89\u88c5\uff08\u5168\u90e8\u9ed8\u8ba4\u5373\u53ef\uff09<\/p>\n

\"git-06\"<\/p>\n

\u4e4b\u540e\uff0c\u5728\u4e00\u4e2a\u6587\u4ef6\u5939\u5185\u53f3\u952e\u9f20\u6807\uff0c\u9009\u62e9\u201cGit Bash Here\u201d<\/p>\n

\u8f93\u5165\u201csudo git clone git@192.168.1.109:\/srv\/MyProject.git\u201d\u5373\u53ef<\/p>\n

\"git-07\"<\/p>\n

\u8f93\u5165\u201cyes\u201d<\/p>\n

\"git-08\"<\/p>\n

\u6b64\u540e\u5373\u53ef\u4f7f\u7528git\u547d\u4ee4\u5bf9\u6587\u4ef6\u3001\u7a0b\u5e8f\u505a\u7248\u672c\u7ba1\u7406\u4e86<\/p>\n

\u672c\u6587\u539f\u521b\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/Ubuntu-Git-server.html<\/a>\u4f5c\u8005\uff1a\u82b3\u6ee1\u697c\uff0c\u5ba1\u6838\u5458\uff1a\u51af\u742a<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u4f7f\u7528linux\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4e0d\u5f97\u4e0d\u63d0Git\u7248\u672c\u7ba1\u7406\u5668\uff0c\u8fd9\u4e2aLinus\u82b1\u4e86\u4e24\u5468\u65f6\u95f4\u5f00\u53d1\u7684\u5206\u5e03\u5f0f\u7248\u672c\u7ba1\u7406\u5668\uff08\u8fd9\u5c31 […]<\/p>\n","protected":false},"author":63,"featured_media":22958,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-23662","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/23662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=23662"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/23662\/revisions"}],"predecessor-version":[{"id":257048,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/23662\/revisions\/257048"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/22958"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=23662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=23662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=23662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}