\u5b89\u88c5Gitosis<\/strong><\/p>\n[root@linuxprobe ~]# cd software\/\r\n[root@linuxprobe software]# git clone https:\/\/github.com\/res0nat0r\/gitosis.git\r\n[root@linuxprobe software]# yum install python-setuptools -y\r\n[root@linuxprobe software]# cd gitosis\r\n[root@linuxprobe gitosis]# sudo python setup.py install\r\n<\/pre>\n\u51fa\u73b0\u4e0b\u9762\u7684\u4fe1\u606f\u8868\u793a\u5b89\u88c5\u6210\u529f\u4e86<\/p>\n
Using \/usr\/lib\/python2.6\/site-packages\r\n Finished processing dependencies for gitosis==0.2\r\n<\/pre>\n2. \u670d\u52a1\u5668\u7aef\u521b\u5efagit\u7528\u6237\u6765\u7ba1\u7406Git\u670d\u52a1<\/strong><\/div>\n[root@linuxprobe ~]# id git \/\/\u67e5\u770bgit\u7528\u6237\u662f\u5426\u5b58\u5728<\/span>\r\nid: git: no such user\r\n[root@linuxprobe ~]# useradd git\r\n[root@linuxprobe ~]# echo \"123\" | passwd --stdin git\r\n[root@linuxprobe ~]# su - git \/\/\u5207\u6362\u5230git\u7528\u6237\u4e0b\r\n<\/span><\/pre>\n3. \u914d\u7f6e\u516c\u94a5<\/strong><\/div>\n\u5728Windows\u4e0a\u914d\u7f6e\u7ba1\u7406\u8005\uff0cgit\u670d\u52a1\u5668\u9700\u8981\u4e00\u4e9b\u7ba1\u7406\u8005\uff0c\u901a\u8fc7\u4e0a\u4f20\u5f00\u53d1\u8005\u673a\u5668\u7684\u516c\u94a5\u5230\u670d\u52a1\u5668\uff0c\u6dfb\u52a0\u6210\u4e3agit\u670d\u52a1\u5668\u7684\u7ba1\u7406\u8005,\u6253\u5f00git\u547d\u4ee4\u884c<\/p>\n
$ ssh-keygen -t rsa \/\/\u4e00\u76f4\u56de\u8f66\uff0c\u4e0d\u9700\u8981\u8bbe\u7f6e\u5bc6\u7801<\/span>\r\n~ scp ~\/.ssh\/id_rsa.pub git@192.168.34.184:~ \/\/\u590d\u5236\u5230git\u670d\u52a1\u5668\u4e0a\r\n<\/span><\/pre>\n4. \u914d\u7f6egitosis<\/strong><\/div>\n\u4f7f\u7528git\u7528\u6237\u5e76\u521d\u59cb\u5316gitosis<\/p>\n
[root@linuxprobe ~]# cd .ssh\r\n[root@linuxprobe ~]# gitosis-init < .\/id_rsa.pub\r\nInitialized empty Git repository in \/home\/git\/repositories\/gitosis-admin.git\/\r\nReinitialized existing Git repository in \/home\/git\/repositories\/gitosis-admin.git\/\r\n[root@linuxprobe ~]# chmod 755 \/home\/git\/repositories\/gitosis-admin.git\/hooks\/post-update \/\/\u6dfb\u52a0\u6743\u9650\r\n<\/span><\/pre>\n\u5728Windows\u4e0a\u673a\u5668\u4e0aclone gitosis-admin\u5230\u7ba1\u7406\u8005\u4e3b\u673a<\/p>\n
$ git clone ssh:\/\/git@192.168.34.184:22\/gitosis-admin.git\r\n$ cd gitosis-admin\r\n$ ls\r\n$ gitosis.conf\tkeydir\r\n<\/pre>\ngitosis.conf<\/span>: git\u670d\u52a1\u5668\u914d\u7f6e\u6587\u4ef6<\/p>\nkeydir<\/span>: \u5b58\u653e\u5ba2\u6237\u7aef\u516c\u94a5<\/p>\n\u914d\u7f6egitosis.conf<\/strong>\u6587\u4ef6<\/p>\n$ vim gitosis.conf\r\n[gitosis]\r\n\r\n[group gitosis-admin] #\u7ec4\u540d\u79f0<\/span>\r\nmembers = yueyong@SHA2-001 #\u7ec4\u6210\u5458<\/span>\r\nwritable = gitosis-admin #\u9879\u76ee\u540d\u79f0<\/span>\r\n\r\n[group test] \/\/\u8fd9\u91cc\u6dfb\u52a0\u4e86\"test\"\u9879\u76ee\u7ec4,\u4e0a\u4f20\u5230\u4e2agit\u670d\u52a1\u5668<\/span>\r\nmembers = yueyong@SHA2-001\r\nwritable = test\r\n<\/pre>\n\u5728Windows\u7ba1\u7406\u8005\u673a\u5668\u4e0a\u521b\u5efa\u672c\u5730test\u4ed3\u5e93\uff0c\u5e76\u4e0a\u4f20\u5230git\u670d\u52a1\u7aef<\/p>\n
$ git config --global user.name \"Your Name\" \/\/\u7b2c\u4e00\u6b21\u63d0\u4ea4\u9700\u8981\u8bbe\u7f6e\u4e2a\u4eba\u4fe1\u606f\uff0c\u8bbe\u7f6e\u7528\u6237\u540d\u548c\u90ae\u7bb1<\/span>\r\n$ git config --global user.email \"email@example.com\"\r\n$ cd ~\/repo \r\n$ mkdir test\r\n$ git init\r\n$ tocuh readme.txt\r\n<\/pre>\n\u63d0\u4ea4\u5230\u8fdc\u7a0b\u670d\u52a1\u5668<\/p>\n
$ git add .\r\n$ git commit -a -m 'init test'\r\n$ git remote add repo git@192.168.186.129:test.git \/\/repo \u8fdc\u7a0b\u5e93\u7684\u540d\u79f0\uff0c\u53ef\u4ee5\u6362\u6210\u4efb\u610f\u540d\u79f0<\/span>\r\n$ git push repo master \/\/\u4e0a\u4f20\u672c\u5730\u6240\u6709\u5206\u652f\u4ee3\u7801\u5230\u8fdc\u7a0b\u5bf9\u5e94\u7684\u5206\u652f\u4e0a\r\n<\/span><\/pre>\n\u670d\u52a1\u7aef\u4f1a\u81ea\u52a8\u521b\u5efatest\u4ed3\u5e93<\/p>\n
[git@repositories]# pwd\r\n\/home\/git\/repositories\r\n[git@linuxprobe repositories]$ ls\r\ngitosis-admin.git test.git\r\n<\/pre>\n5.\u6dfb\u52a0\u5176\u4ed6git\u7528\u6237\u5f00\u53d1\u8005<\/strong><\/div>\n\u7531\u4e8e\u516c\u53f8\u5f00\u53d1\u56e2\u961f\u4eba\u6570\u4e0d\u65ad\u589e\u591a\uff0c\u624b\u52a8\u6dfb\u52a0\u5f00\u53d1\u8005\u79c1\u94a5\u5230\/home\/git\/.ssh\/authorized_keys\u6bd4\u8f83\u9ebb\u70e6\uff0c\u901a\u8fc7\u4e0a\u9762\u7684Windows\u673a\u5668\u7684\u7ba1\u7406\u8005\u7edf\u4e00\u6536\u96c6\u5176\u4ed6\u5f00\u53d1\u8005\u7684\u79c1\u94a5id_rsa.pub\u6587\u4ef6\uff0c\u7136\u540e\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u914d\u7f6e\u597d\u540e\uff0c\u7528\u6237\u5373\u83b7\u5f97\u9879\u76ee\u6743\u9650\uff0c\u53ef\u4ee5\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u62c9\u53d6\u548c\u63a8\u9001\u9879\u76ee\uff0c\u8fbe\u5230\u5171\u540c\u5f00\u53d1\u9879\u76ee\u3002<\/p>\n
$ cd ~\/gitosis-admin\/keydir\r\n$ mv ~\/id_rsa.pub zhangsan@SHA2-002.pub \/\/\u4fee\u6539\u516c\u94a5\u4e3a\u4e3b\u673a\u540d.pub<\/span>\r\n$ vim gitosis.conf\r\n [group test]\r\n writable = test\r\n members = yueyong@SHA2-001 zhangsan@SHA2-002 \/\/\u6dfb\u52a0\u6210\u5458\r\n<\/span><\/pre>\n$ git add .\r\n$ git commit -m \"add zhangsan@SHA2-002 pub and update gitosis.conf\"\r\n$ git push repo master\r\n<\/pre>\n\u63a8\u9001\u5b8c\u6210\u540e\uff0c\u65b0\u52a0\u8fdb\u6765\u7684\u5f00\u53d1\u8005\u5c31\u53ef\u4ee5\u8fdb\u884c\u9879\u76ee\u7684\u5f00\u53d1\u4e86\uff0c\u540e\u7eed\u589e\u52a0\u4eba\u5458\u53ef\u4ee5\u8fd9\u6837\u6dfb\u52a0\u8fdb\u6765\uff0c\u5f00\u53d1\u8005\u76f4\u63a5\u628a\u4ed3\u5e93clone\u4e0b\u6765\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n
git clone git@192.168.34.184:\/home\/git\/repositories\/test.git\r\n\u62a5\u9519\u95ee\u9898\uff1aERROR:gitosis serve main repository read access denied<\/span>\r\n\u6839\u636e\u8fd9\u4e2a\u62a5\u9519\uff0c\u53ef\u4ee5\u770b\u51fakey\u662f\u6ca1\u95ee\u9898\u7684\uff0c\u901a\u8fc7\u6392\u67e5\uff0c\u53d1\u73b0\u4e0d\u5e94\u8be5\u628a\u8fd9\u4e2a\/home\/git\/repositories\/test.git\u5199\u5168\uff0c\r\ngit clone git@192.168.34.184:test.git\r\n\u8fd9\u6837\u5c31\u53ef\u4ee5\u4e86\u3002\r\n<\/pre>\n\u672c\u6587\u539f\u521b\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/linux-deploy-git.html<\/a>\u4f5c\u8005\uff1a\u5cb3\u6c38\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"\u5bfc\u8bfb \u4f17\u6240\u5468\u77e5\uff0c\u7248\u672c\u7cfb\u7edf\u5728\u5f00\u53d1\u73af\u5883\u4e2d\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0c\u4f46\u662f\u6211\u4eec\u53ef\u4ee5\u628a\u4ee3\u7801\u514d\u8d39\u7684\u6258\u7ba1\u5230GitHub\u4e0a\uff0c\u5982\u679c\u6211\u4eec\u4e0d\u539f\u610f […]<\/p>\n","protected":false},"author":63,"featured_media":25354,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-55218","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\/55218","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=55218"}],"version-history":[{"count":18,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/55218\/revisions"}],"predecessor-version":[{"id":275705,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/55218\/revisions\/275705"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/25354"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=55218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=55218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=55218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}