{"id":121,"date":"2018-05-08T17:17:43","date_gmt":"2018-05-08T09:17:43","guid":{"rendered":"http:\/\/chenhaitao.me\/?p=121"},"modified":"2018-05-08T17:17:43","modified_gmt":"2018-05-08T09:17:43","slug":"%e8%bd%accentos7-%e4%b8%8b-%e5%ae%89%e8%a3%85git-%e5%b9%b6%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/2018\/05\/08\/%e8%bd%accentos7-%e4%b8%8b-%e5%ae%89%e8%a3%85git-%e5%b9%b6%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e9%83%a8%e7%bd%b2\/","title":{"rendered":"[\u8f6c]centos7 \u4e0b \u5b89\u88c5git \u5e76\u5b9e\u73b0\u81ea\u52a8\u90e8\u7f72"},"content":{"rendered":"<div class=\"markdown_views\">\n<p><strong>1\u3001\u9996\u5148\u9700\u8981\u5b89\u88c5Git\uff0c\u53ef\u4ee5\u4f7f\u7528yum\u6e90\u5728\u7ebf\u5b89\u88c5\uff1a<\/strong><\/p>\n<pre class=\"prettyprint\"><code class=\"hljs cmake has-numbering\">yum <span class=\"hljs-keyword\">install<\/span> -y git<\/code><\/pre>\n<p><strong>2\u3001\u521b\u5efa\u4e00\u4e2agit\u7528\u6237\uff0c\u7528\u6765\u8fd0\u884cgit\u670d\u52a1<\/strong><\/p>\n<pre class=\"prettyprint\"><code class=\"hljs  has-numbering\">adduser git\r\npasswd git<\/code><\/pre>\n<p><strong>3\u3001\u521d\u59cb\u5316git\u4ed3\u5e93\uff1a\u8fd9\u91cc\u6211\u4eec\u9009\u62e9\/data\/git\/learngit.git\u6765\u4f5c\u4e3a\u6211\u4eec\u7684git\u4ed3\u5e93<\/strong><\/p>\n<pre class=\"prettyprint\"><code class=\"hljs haskell has-numbering\"><span class=\"hljs-title\">mkdir<\/span> \/<span class=\"hljs-typedef\"><span class=\"hljs-keyword\">data<\/span>\/git -p<\/span>\r\n<span class=\"hljs-title\">cd<\/span> \/<span class=\"hljs-typedef\"><span class=\"hljs-keyword\">data<\/span>\/git<\/span>\r\n<span class=\"hljs-title\">git<\/span> init <span class=\"hljs-comment\">--bare learngit.git  #\u521d\u59cb\u5316\u4ed3\u5e93<\/span><\/code><\/pre>\n<p>\u6267\u884c\u4ee5\u4e0a\u547d\u4ee4\uff0c\u4f1a\u521b\u5efa\u4e00\u4e2a\u88f8\u4ed3\u5e93\uff0c\u88f8\u4ed3\u5e93\u6ca1\u6709\u5de5\u4f5c\u533a\uff0c\u56e0\u4e3a\u670d\u52a1\u5668\u4e0a\u7684Git\u4ed3\u5e93\u7eaf\u7cb9\u662f\u4e3a\u4e86\u5171\u4eab\uff0c\u6240\u4ee5\u4e0d\u8ba9\u7528\u6237\u76f4\u63a5\u767b\u5f55\u5230\u670d\u52a1\u5668\u4e0a\u53bb\u6539\u5de5\u4f5c\u533a\uff0c\u5e76\u4e14\u670d\u52a1\u5668\u4e0a\u7684Git\u4ed3\u5e93\u901a\u5e38\u90fd\u4ee5.git\u7ed3\u5c3e\u3002\u7136\u540e\uff0c\u628aowner\u6539\u4e3agit<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs css has-numbering\"><span class=\"hljs-tag\">chown<\/span> <span class=\"hljs-tag\">git<\/span><span class=\"hljs-pseudo\">:git<\/span> <span class=\"hljs-tag\">learngit<\/span><span class=\"hljs-class\">.git<\/span>  <span class=\"hljs-tag\">-R<\/span><\/code><\/pre>\n<p><strong>4\u3001\u5728\u8fd9\u91cc\uff0cGit\u670d\u52a1\u5668\u5c31\u5df2\u7ecf\u642d\u5f97\u5dee\u4e0d\u591a\u4e86\u3002\u4e0b\u9762\u6211\u4eec\u5728\u5ba2\u6237\u7aefclone\u4e00\u4e0b\u8fdc\u7a0b\u4ed3\u5e93\u3002<\/strong><br \/>\nmsysGit\u5b98\u7f51\u4e0b\u8f7d\u5730\u5740 \uff1a<a href=\"http:\/\/gitforwindows.org\/\" target=\"_blank\" rel=\"noopener\">http:\/\/gitforwindows.org\/<\/a>\uff0c\u4e0b\u8f7d\u5b89\u88c5git \u5ba2\u6237\u7aef\u540e\uff0c\u6267\u884cclone<br \/>\n\u65b0\u5efa\u4e2a\u6587\u4ef6\u5939\uff0c\u672c\u6587\u4ee5D:\\git\u4e3a\u4f8b<br \/>\n\u6253\u5f00git\u6587\u4ef6\u5939\uff0c\u53f3\u51fb\u6253\u5f00\u547d\u4ee4\u7a97\u53e3<\/p>\n<p><img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180119235456905?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZ3V5YW4wMzE5\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u6267\u884c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs ruby has-numbering\">git clone git<span class=\"hljs-variable\">@192<\/span>.<span class=\"hljs-number\">168.1<\/span>.<span class=\"hljs-number\">120<\/span><span class=\"hljs-symbol\">:\/data\/git\/learngit<\/span>.git<\/code><\/pre>\n<p><img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180119235742197?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZ3V5YW4wMzE5\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u56de\u8f66<\/p>\n<p><img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180120000019884?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZ3V5YW4wMzE5\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fd9\u91cc\u4e24\u70b9\u9700\u8981\u6ce8\u610f\uff1a\u7b2c\u4e00\uff0c\u5f53\u4f60\u7b2c\u4e00\u6b21\u4f7f\u7528Git\u7684clone\u6216\u8005push\u547d\u4ee4\u8fde\u63a5GitHub\u65f6\uff0c\u4f1a\u5f97\u5230\u4e00\u4e2a\u8b66\u544a\uff1a<br \/>\nThe authenticity of host \u2018github.com (xx.xx.xx.xx)\u2019 can\u2019t be established.<br \/>\nRSA key fingerprint is xx.xx.xx.xx.xx.<br \/>\nAre you sure you want to continue connecting (yes\/no)?<br \/>\n\u8fd9\u662f\u56e0\u4e3aGit\u4f7f\u7528SSH\u8fde\u63a5\uff0c\u800cSSH\u8fde\u63a5\u5728\u7b2c\u4e00\u6b21\u9a8c\u8bc1GitHub\u670d\u52a1\u5668\u7684Key\u65f6\uff0c\u9700\u8981\u4f60\u786e\u8ba4GitHub\u7684Key\u7684\u6307\u7eb9\u4fe1\u606f\u662f\u5426\u771f\u7684\u6765\u81eaGitHub\u7684\u670d\u52a1\u5668\uff0c\u8f93\u5165yes\u56de\u8f66\u5373\u53ef\u3002<br \/>\n\u8f93\u5165yes\u4e00\u822c\u4f1a\u51fa\u73b0<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180120000510716?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZ3V5YW4wMzE5\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u518d\u6b21\u6267\u884c<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs ruby has-numbering\">git clone git<span class=\"hljs-variable\">@192<\/span>.<span class=\"hljs-number\">168.1<\/span>.<span class=\"hljs-number\">120<\/span><span class=\"hljs-symbol\">:\/data\/git\/learngit<\/span>.git<\/code><\/pre>\n<p>\u4f1a\u51fa\u73b0\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u8f93\u5165git\u7684\u5bc6\u7801\uff0c\u6b64\u5904\u6211\u4eec\u7528\u7684\u5bc6\u7801\u8fde\u63a5git\u5e93\uff0c\u4f46\u662f\u66f4\u4e3a\u5e38\u89c1\u7684\u65b9\u5f0f\uff0c\u662f\u5229\u7528SSH\u7684\u516c\u94a5\u6765\u5b8c\u6210\u9a8c\u8bc1\u3002<br \/>\n\u5982\u679c\u987a\u5229\u7684\u8bdd\u6267\u884cclone\u540e\u4f1a\u51fa\u73b0<br \/>\n<img decoding=\"async\" title=\"\" src=\"https:\/\/img-blog.csdn.net\/20180120000909391?watermark\/2\/text\/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZ3V5YW4wMzE5\/font\/5a6L5L2T\/fontsize\/400\/fill\/I0JBQkFCMA==\/dissolve\/70\/gravity\/SouthEast\" alt=\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p><strong>5\u3001\u521b\u5efaSSH Key<\/strong><br \/>\n\u9996\u5148\u5728\u7528\u6237\u4e3b\u76ee\u5f55\u4e0b\uff0c\u770b\u770b\u6709\u6ca1\u6709.ssh\u76ee\u5f55\uff0c\u5982\u679c\u6709\uff0c\u518d\u770b\u770b\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u6709\u6ca1\u6709id_rsa\u548cid_rsa.pub\u8fd9\u4e24\u4e2a\u6587\u4ef6\uff0c\u5982\u679c\u5df2\u7ecf\u6709\u4e86\uff0c\u53ef\u76f4\u63a5\u8df3\u5230\u4e0b\u4e00\u6b65\u3002\u5982\u679c\u6ca1\u6709\uff0c\u6253\u5f00Shell\uff08Windows\u4e0b\u6253\u5f00Git Bash\uff09\uff0c\u521b\u5efaSSH Key\uff1a<br \/>\n$ ssh-keygen -t rsa -C \u201cyouremail@example.com\u201d<br \/>\n\u4f60\u9700\u8981\u628a\u90ae\u4ef6\u5730\u5740\u6362\u6210\u4f60\u81ea\u5df1\u7684\u90ae\u4ef6\u5730\u5740\uff0c\u7136\u540e\u4e00\u8def\u56de\u8f66\uff0c\u4f7f\u7528\u9ed8\u8ba4\u503c\u5373\u53ef\uff0c\u4e00\u822c\u65e0\u9700\u8bbe\u7f6e\u5bc6\u7801\u3002<br \/>\n\u5982\u679c\u4e00\u5207\u987a\u5229\u7684\u8bdd\uff0c\u53ef\u4ee5\u5728\u7528\u6237\u4e3b\u76ee\u5f55\u91cc\u627e\u5230.ssh\u76ee\u5f55\uff0c\u91cc\u9762\u6709id_rsa\u548cid_rsa.pub\u4e24\u4e2a\u6587\u4ef6\uff0c\u8fd9\u4e24\u4e2a\u5c31\u662fSSH Key\u7684\u79d8\u94a5\u5bf9\uff0cid_rsa\u662f\u79c1\u94a5\uff0c\u4e0d\u80fd\u6cc4\u9732\u51fa\u53bb\uff0cid_rsa.pub\u662f\u516c\u94a5\uff0c\u53ef\u4ee5\u653e\u5fc3\u5730\u544a\u8bc9\u4efb\u4f55\u4eba\u3002<br \/>\n<strong>6\u3001Git\u670d\u52a1\u5668\u6253\u5f00RSA\u8ba4\u8bc1<\/strong><br \/>\n\u7136\u540e\u5c31\u53ef\u4ee5\u53bbGit\u670d\u52a1\u5668\u4e0a\u6dfb\u52a0\u4f60\u7684\u516c\u94a5\u7528\u6765\u9a8c\u8bc1\u4f60\u7684\u4fe1\u606f\u4e86\u3002\u5728Git\u670d\u52a1\u5668\u4e0a\u9996\u5148\u9700\u8981\u5c06\/etc\/ssh\/sshd_config\u4e2d\u5c06RSA\u8ba4\u8bc1\u6253\u5f00\uff0c\u5373\uff1a<br \/>\n1.RSAAuthentication yes<br \/>\n2.PubkeyAuthentication yes<br \/>\n3.AuthorizedKeysFile .ssh\/authorized_keys<br \/>\n\u8fd9\u91cc\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u516c\u94a5\u5b58\u653e\u5728.ssh\/authorized_keys\u6587\u4ef6\u4e2d\u3002\u6240\u4ee5\u6211\u4eec\u5728\/home\/git\u4e0b\u521b\u5efa.ssh\u76ee\u5f55\uff0c\u7136\u540e\u521b\u5efaauthorized_keys\u6587\u4ef6\uff0c\u5e76\u5c06\u521a\u751f\u6210\u7684\u516c\u94a5\u5bfc\u5165\u8fdb\u53bb\u3002<br \/>\n\u7136\u540e\u518d\u6b21clone\u7684\u65f6\u5019\uff0c\u6216\u8005\u662f\u4e4b\u540epush\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u9700\u8981\u518d\u8f93\u5165\u5bc6\u7801\u4e86\uff1a<\/p>\n<p><strong>7\u3001\u7981\u7528git\u7528\u6237\u7684shell\u767b\u9646<\/strong><br \/>\n\u51fa\u4e8e\u5b89\u5168\u8003\u8651\uff0c\u7b2c\u4e8c\u6b65\u521b\u5efa\u7684git\u7528\u6237\u4e0d\u5141\u8bb8\u767b\u5f55shell\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91\/etc\/passwd\u6587\u4ef6\u5b8c\u6210\u3002\u627e\u5230\u7c7b\u4f3c\u4e0b\u9762\u7684\u4e00\u884c\uff1a<br \/>\ngit:x:1001:1001:,,,:\/home\/git:\/bin\/bash<br \/>\n\u6700\u540e\u4e00\u4e2a\u5192\u53f7\u540e\u6539\u4e3a\uff1a<br \/>\ngit:x:1001:1001:,,,:\/home\/git:\/usr\/bin\/git-shell<br \/>\n\u8fd9\u6837\uff0cgit\u7528\u6237\u53ef\u4ee5\u6b63\u5e38\u901a\u8fc7ssh\u4f7f\u7528git\uff0c\u4f46\u65e0\u6cd5\u767b\u5f55shell\uff0c\u56e0\u4e3a\u6211\u4eec\u4e3agit\u7528\u6237\u6307\u5b9a\u7684git-shell\u6bcf\u6b21\u4e00\u767b\u5f55\u5c31\u81ea\u52a8\u9000\u51fa\u3002<br \/>\n<strong>8\u3001\u914d\u7f6e\u81ea\u52a8\u90e8\u7f72hooks<\/strong><br \/>\n\u8fdb\u5165\u670d\u52a1\u5668<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs avrasm has-numbering\">cd \/data\/git\/learngit<span class=\"hljs-preprocessor\">.git<\/span>\/hooks\r\n<span class=\"hljs-keyword\">cp<\/span> post-update<span class=\"hljs-preprocessor\">.sample<\/span> post-update <span class=\"hljs-preprocessor\">#\u521b\u5efa\u81ea\u52a8\u90e8\u7f72\u811a\u672c\u6587\u4ef6<\/span>\r\n<\/code><\/pre>\n<p>post-update \u5185\u5bb9<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-shebang\">#!\/bin\/sh<\/span>\r\n<span class=\"hljs-comment\">#<\/span>\r\n<span class=\"hljs-comment\"># An example hook script to prepare a packed repository for use over<\/span>\r\n<span class=\"hljs-comment\"># dumb transports.<\/span>\r\n<span class=\"hljs-comment\">#<\/span>\r\n<span class=\"hljs-comment\"># To enable this hook, rename this file to \"post-update\".<\/span>\r\n\r\n<span class=\"hljs-comment\">#exec git update-server-info<\/span>\r\nWEB_PATH=<span class=\"hljs-string\">'\/var\/www\/c'<\/span>  <span class=\"hljs-comment\">#\u7f51\u7ad9\u6839\u76ee\u5f55<\/span>\r\nWEB_USER=<span class=\"hljs-string\">'www'<\/span>  <span class=\"hljs-comment\">#\u6240\u5c5e\u7528\u6237<\/span>\r\nWEB_USERGROUP=<span class=\"hljs-string\">'www'<\/span> <span class=\"hljs-comment\">#\u6240\u5c5e\u7528\u6237\u7ec4<\/span>\r\ngit --work-tree=<span class=\"hljs-variable\">$WEB_PATH<\/span> checkout develop <span class=\"hljs-operator\">-f<\/span>   <span class=\"hljs-comment\">#\u68c0\u51fadevelop\u5206\u652f\u5230\u7f51\u7ad9\u76ee\u5f55<\/span>\r\n<span class=\"hljs-built_in\">echo<\/span>  <span class=\"hljs-string\">'xxxxxxxx'<\/span> |<span class=\"hljs-built_in\">sudo<\/span> -S  chown <span class=\"hljs-variable\">$WEB_USER<\/span>:<span class=\"hljs-variable\">$WEB_USERGROUP<\/span>  <span class=\"hljs-variable\">$WEB_PATH<\/span> -R  <span class=\"hljs-comment\">#\u4fee\u6539\u7f51\u7ad9\u76ee\u5f55\u6240\u5c5e\u7528\u6237\u548c\u7528\u6237\u7ec4<\/span><\/code><\/pre>\n<p>\u4fee\u6539\u7f51\u7ad9\u76ee\u5f55\u6743\u9650\u662f\u56e0\u4e3a\u6bcf\u6b21\u68c0\u51fa\u6e90\u7801\u6240\u5c5e\u7528\u6237\u548c\u7528\u6237\u7ec4\u90fd \u662fgit \u7f51\u7ad9\u8fd0\u884c\u4f1a\u51fa\u95ee\u9898\uff0c\u9700\u8981\u91cd\u65b0\u4fee\u6539\u6240\u5c5e\u7528\u6237\u548c\u7528\u6237\u7ec4\uff0c\u5728\u6b64\u6ce8\u610f\uff0csudo\u547d\u4ee4\u6267\u884c\u4f1a\u62a5\u201csudo\uff1a\u62b1\u6b49\uff0c\u60a8\u5fc5\u987b\u62e5\u6709\u4e00\u4e2a\u7ec8\u7aef\u6765\u6267\u884c sudo\u201d\u9519\u8bef\uff0c\u89e3\u51b3\u529e\u6cd5<br \/>\n\u6253\u5f00 \/etc\/sudoers \u6587\u4ef6\uff0c\u5c06\u4ee5\u4e0b\u5185\u5bb9\u6ce8\u91ca\u5373\u53ef<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs sql has-numbering\">#Disable \u201cssh hostname sudo \u201d, because it will <span class=\"hljs-operator\"><span class=\"hljs-keyword\">show<\/span> the password <span class=\"hljs-keyword\">in<\/span> clear.\r\nYou have <span class=\"hljs-keyword\">to<\/span> run \u201cssh -t hostname sudo \u201d.\r\n# Defaults requiretty\r\n\u6539\u6210\r\nDefaults requiretty\r\n\u540c\u65f6\u6dfb\u52a0 \r\ngit <span class=\"hljs-keyword\">ALL<\/span>=(<span class=\"hljs-keyword\">ALL<\/span>) <span class=\"hljs-keyword\">ALL<\/span><\/span><\/code><\/pre>\n<p><strong>9\u3001\u6d4b\u8bd5<\/strong><br \/>\n\u4f60\u53ef\u4ee5\u5728\u5ba2\u6237\u7aef\u63a8\u9001\u4e2a\u6587\u4ef6\u6d4b\u8bd5\uff0c\u67e5\u770b\u670d\u52a1\u5668\u7f51\u7ad9\u76ee\u5f55\u662f\u5426\u6709\u63a8\u9001\u7684\u6587\u4ef6\u3002<\/p>\n<p><strong>\u4e3b\u8981\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u4e00\u3001\u5b89\u88c5\u51fa\u73b0\u95ee\u9898<br \/>\nFile \u201c\/usr\/bin\/gitosis-init\u201d, line 9, in<\/p>\n<p>\u5728linux \u73af\u5883\u4e0b\u751f\u6210\u79d8\u94a5 \u6709\u6ca1\u95ee\u9898\u4e86<\/p>\n<p>\u4e8c \u3001\u89e3\u51b3\u4e0d\u80fd\u8f7d\u5165\u79c1\u94a5\u95ee\u9898<\/p>\n<p>\u627e\u5230\u89e3\u51b3\u4e86\u65b9\u6cd5\uff1a<\/p>\n<p>1\uff09\u8fd0\u884cPuTTYGen\uff0c\u5728Conversions\u83dc\u5355\u4e2d\u70b9\u51fbImport key\uff0c\u9009\u62e9ssh-keygen\u751f\u6210\u7684\u79c1\u94a5\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff0c\u6bd4\u5982id_rsa\u6587\u4ef6\u3002<\/p>\n<p>2\uff09\u70b9\u51fbSave private key\u6309\u94ae\uff0c\u5c06\u5176\u4fdd\u5b58\u4e3a.ppk\u6587\u4ef6\u3002<\/p>\n<p>3\uff09\u6253\u5f00Pageant\uff0c\u70b9\u51fbAdd Key\uff0c\u9009\u62e9\u524d\u4e00\u6b65\u6240\u4fdd\u5b58\u7684.ppk\u6587\u4ef6\u6240\u5728\u7684\u4f4d\u7f6e\u5373\u53ef\u3002<\/p>\n<p>\u4e09 \u3001\u516c\u94a5\u548c\u79c1\u94a5\u6587\u4ef6\u6743\u9650\u8bbe\u7f6e \u3002\u8fd9\u4e00\u6b65\u5f88\u91cd\u8981 \u3002\u5426\u5219\u4f1a\u9a8c\u8bc1\u5931\u8d25 \u3002<br \/>\nSSH\u5bf9\u516c\u94a5\u3001\u79c1\u94a5\u7684\u6743\u9650\u548c\u6240\u6709\u6743\u7684\u8981\u6c42\u662f\u975e\u5e38\u4e25\u683c\u7684\uff0c\u603b\u7ed3\u5982\u4e0b\uff1a<br \/>\n1\u3001\u4e0b\u9762\u4e24\u4e2a\u76ee\u5f55\u7684\u6240\u6709\u6743\u5fc5\u987b\u662fuser\uff0c\u6240\u5c5e\u7ec4\u4e5f\u5e94\u8be5\u662fuser\uff0c\u6743\u9650\u5fc5\u987b\u4e3a700 (\u91cd\u8981 \u5bbf\u673a\u548c\u76ee\u6807\u673a)<br \/>\n\\home\\user<br \/>\n\\home\\user.ssh<br \/>\n2\u3001\u76ee\u6807\u673a\u4e0b\u9762\u516c\u94a5\u6587\u4ef6\u7684\u6240\u6709\u6743\u5fc5\u987b\u662fuser\uff0c\u6240\u5c5e\u7ec4\u4e5f\u5e94\u8be5\u662fuser\uff0c\u6743\u9650\u5fc5\u987b\u4e3a644 \u6216600\uff08\u65b0\u7248centos7\uff09<br \/>\n\\home\\user.ssh\\authorized_keys \uff08644,600\uff09<br \/>\n\\home\\user.ssh \uff08700\uff09<br \/>\n3\u3001\u4e0b\u9762\u79c1\u94a5\u6587\u4ef6\u7684\u6240\u6709\u6743\u5fc5\u987b\u662fuser\uff0c\u6240\u5c5e\u7ec4\u4e5f\u5e94\u8be5\u662fuser\uff0c\u6743\u9650\u5fc5\u987b\u662f600<br \/>\n\\home\\user.ssh\\id_rsa<\/p>\n<p>\u5728centos\u4e0a\u9762\u901a\u8fc7 chown\u547d\u4ee4\u66f4\u6539\u6587\u4ef6\u6240\u6709\u6743\u548c\u6240\u5c5e\u7528\u6237\u7ec4 \uff0c\u901a\u8fc7chmod\u547d\u4ee4\u66f4\u6539\u6743\u9650 \u3002<br \/>\n\u4f46\u662f\u7b2c\u4e09\u6b65\u7684\u79c1\u94a5\u6587\u4ef6\u7684\u6743\u9650\u5728win7\u4e0b\u9762\u597d\u50cf\u65e0\u6cd5\u8bbe\u7f6e \u3002\u5373\u4f7f\u5728git bash\u91cc\u9762\u7528\u4e86chmod 600 \u6765\u6539\u53d8\u79c1\u94a5\u6587\u4ef6\u7684\u6743\u9650\u8fd8\u662f\u6ca1\u6709\u7528\u5904\uff0c\u7528 ls -l ~\/..ssh\u6765\u67e5\u770b \uff0c\u8fd8\u662f\u5176\u4ed6\u7528\u6237\u7528\u8bfb\u7684\u6743\u9650 \u3002\u3002\u3002<br \/>\n\u6211\u81ea\u5df1\u4f7f\u7528\u7684\u662f\u76f4\u63a5\u5c06C:\\Users\\Administrator.ssh\u76ee\u5f55\u8bbe\u4e3a\u53ea\u7528\u5f53\u524d\u7ba1\u7406\u5458\u624d\u6709\u6743\u9650 \u3002\u5176\u4ed6\u7684\u76ee\u5f55\u4e5f\u53d8\u6210\u4e86\u53ea\u7528\u7ba1\u7406\u5458\u624d\u53ef\u8bfb\u7684\u6587\u4ef6 \uff0c\u5176\u4ed6\u7528\u6237\u6ca1\u6709\u8bfb\u53d6\u7684\u6743\u9650 \u3002\u8fd9\u6837\u4e5f\u5b9e\u73b0\u4e86 600 \u3002<\/p>\n<p>\u56db \u5982\u679c\u62c9\u53d6\u4e0d\u6210\u529f<\/p>\n<p>1\u3001Please make sure you have the correct access rights<br \/>\nand the repository exists.<br \/>\n\u68c0\u67e5\u8def\u5f84\u662f\u5426\u6b63\u786e<\/p>\n<p>2\uff0c\u5c1d\u8bd5\u63a8\u9001\u4e00\u4e2a\u6587\u4ef6<\/p>\n<p>git\u5ba2\u6237\u7aef\u5b89\u88c5\u53ef\u53c2\u8003<br \/>\nsourcetree<br \/>\n<a href=\"https:\/\/www.cnblogs.com\/Lam7\/p\/6004737.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.cnblogs.com\/Lam7\/p\/6004737.html<\/a><br \/>\nTortoiseGit\u5b89\u88c5\u8be6\u89e3<br \/>\n<a href=\"https:\/\/www.cnblogs.com\/xinlj\/p\/5978730.html\" target=\"_blank\" rel=\"noopener\">https:\/\/www.cnblogs.com\/xinlj\/p\/5978730.html<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u9996\u5148\u9700\u8981\u5b89\u88c5Git\uff0c\u53ef\u4ee5\u4f7f\u7528yum\u6e90\u5728\u7ebf\u5b89\u88c5\uff1a yum install -y git 2\u3001\u521b\u5efa\u4e00\u4e2agit\u7528\u6237\uff0c\u7528\u6765\u8fd0\u884cgit\u670d\u52a1 adduser git p&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/chenhaitao.com\/.wp-toolkit_I\/2018\/05\/08\/%e8%bd%accentos7-%e4%b8%8b-%e5%ae%89%e8%a3%85git-%e5%b9%b6%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e9%83%a8%e7%bd%b2\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[30],"tags":[38],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-30","tag-git"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9HWWB-1X","jetpack-related-posts":[{"id":148,"url":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/2018\/09\/28\/%e8%bd%ac%e5%9c%a8centos-7%e4%b8%ad%e6%90%ad%e5%bb%bagit%e6%9c%8d%e5%8a%a1%e5%99%a8\/","url_meta":{"origin":121,"position":0},"title":"[\u8f6c]\u5728CentOS 7\u4e2d\u642d\u5efaGit\u670d\u52a1\u5668","author":"\u6770\u514b\u9648","date":"2018\u5e749\u670828\u65e5","format":false,"excerpt":"\u73af\u5883\u8bf4\u660e - CentOS 7.x \u6700\u5c0f\u5b89\u88c5 - \u914d\u7f6e\u7f51\u7edc\u8fde\u63a5 1. \u5b89\u88c5Git\u53ca\u521b\u5efa\u7528\u6237 # \u5b89\u88c5\u2026","rel":"","context":"\u5728\u201ccentos\u201d\u4e2d","block_context":{"text":"centos","link":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/tag\/centos\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":115,"url":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/2018\/05\/08\/%e8%bd%accentos%e6%90%ad%e5%bb%bagit%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%b9%b6%e5%90%8c%e6%ad%a5%e7%ba%bf%e4%b8%8a%e9%a1%b9%e7%9b%ae\/","url_meta":{"origin":121,"position":1},"title":"[\u8f6c]centos\u642d\u5efagit\u670d\u52a1\u5668,\u5e76\u540c\u6b65\u7ebf\u4e0a\u9879\u76ee","author":"\u6770\u514b\u9648","date":"2018\u5e745\u67088\u65e5","format":false,"excerpt":"1. \u5b89\u88c5git 2. \u521b\u5efa\u7528\u6237git groupadd git adduser git -g gi\u2026","rel":"","context":"\u5728\u201c\u8fd0\u7ef4\u201d\u4e2d","block_context":{"text":"\u8fd0\u7ef4","link":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/category\/%e8%bf%90%e7%bb%b4\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":123,"url":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/2018\/05\/08\/%e8%bd%acintellij-idea%e4%b8%8b%e7%9a%84%e4%bd%bf%e7%94%a8git\/","url_meta":{"origin":121,"position":2},"title":"[\u8f6c]IntelliJ IDEA\u4e0b\u7684\u4f7f\u7528git","author":"\u6770\u514b\u9648","date":"2018\u5e745\u67088\u65e5","format":false,"excerpt":"1\u3001git\u7b80\u4ecb git\u662f\u76ee\u524d\u6d41\u884c\u7684\u5206\u5e03\u5f0f\u7248\u672c\u7ba1\u7406\u7cfb\u7edf\u3002\u5b83\u62e5\u6709\u4e24\u5957\u7248\u672c\u5e93\uff0c\u672c\u5730\u5e93\u548c\u8fdc\u7a0b\u5e93\uff0c\u5728\u4e0d\u8fdb\u884c\u5408\u5e76\u2026","rel":"","context":"\u5728\u201c\u5f00\u53d1\u201d\u4e2d","block_context":{"text":"\u5f00\u53d1","link":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/category\/%e5%bc%80%e5%8f%91\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":119,"url":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/2018\/05\/08\/%e5%ae%89%e8%a3%85-git\/","url_meta":{"origin":121,"position":3},"title":"\u5b89\u88c5 Git","author":"\u6770\u514b\u9648","date":"2018\u5e745\u67088\u65e5","format":false,"excerpt":"\u662f\u65f6\u5019\u52a8\u624b\u5c1d\u8bd5\u4e0b Git \u4e86\uff0c\u4e0d\u8fc7\u5f97\u5148\u5b89\u88c5\u597d\u5b83\u3002\u6709\u8bb8\u591a\u79cd\u5b89\u88c5\u65b9\u5f0f\uff0c\u4e3b\u8981\u5206\u4e3a\u4e24\u79cd\uff0c\u4e00\u79cd\u662f\u901a\u8fc7\u7f16\u8bd1\u6e90\u4ee3\u7801\u2026","rel":"","context":"\u5728\u201c\u5f00\u53d1\u201d\u4e2d","block_context":{"text":"\u5f00\u53d1","link":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/category\/%e5%bc%80%e5%8f%91\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":49,"url":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/2018\/03\/15\/centos7%e4%b8%8bsvn%e7%9a%84%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae\/","url_meta":{"origin":121,"position":4},"title":"centos7\u4e0bsvn\u7684\u5b89\u88c5\u4e0e\u914d\u7f6e","author":"\u6770\u514b\u9648","date":"2018\u5e743\u670815\u65e5","format":false,"excerpt":"1.\u73af\u5883 centos7 2.\u5b89\u88c5svn yum -y install subversion 3.\u914d\u2026","rel":"","context":"\u5728\u201c\u8fd0\u7ef4\u201d\u4e2d","block_context":{"text":"\u8fd0\u7ef4","link":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/category\/%e8%bf%90%e7%bb%b4\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12,"url":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/2018\/03\/04\/centos-%e7%ae%80%e5%8d%95%e5%ae%89%e8%a3%85vsftpd-%e6%9c%8d%e5%8a%a1%e5%8f%8a%e9%85%8d%e7%bd%ae%e5%8d%b8%e8%bd%bd\/","url_meta":{"origin":121,"position":5},"title":"centos \u7b80\u5355\u5b89\u88c5vsftpd \u670d\u52a1\u53ca\u914d\u7f6e\u5378\u8f7d","author":"\u6770\u514b\u9648","date":"2018\u5e743\u67084\u65e5","format":false,"excerpt":"\u4e00\u3001\u5b89\u88c5 \u9996\u5148\u7528root\u7528\u6237\u767b\u5f55 1\u3001\u68c0\u6d4b\u7cfb\u7edf\u662f\u5426\u5b89\u88c5\u8fc7vsftpd\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a rpm\u00a0 -qa|\u2026","rel":"","context":"\u5728\u201c\u8fd0\u7ef4\u201d\u4e2d","block_context":{"text":"\u8fd0\u7ef4","link":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/category\/%e8%bf%90%e7%bb%b4\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/comments?post=121"}],"version-history":[{"count":1,"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":122,"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/posts\/121\/revisions\/122"}],"wp:attachment":[{"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/media?parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/categories?post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chenhaitao.com\/.wp-toolkit_I\/wp-json\/wp\/v2\/tags?post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}