﻿{"id":1913,"date":"2020-02-29T20:01:36","date_gmt":"2020-02-29T12:01:36","guid":{"rendered":"http:\/\/jilin.hydesign.tw\/?p=1913"},"modified":"2022-05-16T17:36:42","modified_gmt":"2022-05-16T09:36:42","slug":"git-project","status":"publish","type":"post","link":"http:\/\/jilin.hydesign.tw\/index.php\/2020\/02\/29\/git-project\/","title":{"rendered":"Git \u5c08\u6848\u8a2d\u5b9a"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">1. \u8a3b\u518aGitlab\u5e33\u865f<\/h4>\n\n\n\n<p><a href=\"https:\/\/gitlab.com\/\">https:\/\/gitlab.com\/<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. SSH KEY\u8a2d\u5b9a<\/h4>\n\n\n\n<p><strong>\u5275\u5efaSSH Key<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen \u6216 ssh-keygen -t rsa -C \"&#91;gitemail]\"\nEnter file in which to save the key (\/Users\/Jilin\/.ssh\/id_rsa): \n----&gt;enter\nEnter passphrase (empty for no passphrase): \n----&gt;enter\nEnter same passphrase again: \n----&gt;enter<\/code><\/pre>\n\n\n\n<p><strong>\u8907\u88fdssh key\u5230GitLab\u4e2d<\/strong><br><a href=\"https:\/\/gitlab.com\/profile\/keys\">https:\/\/gitlab.com\/profile\/keys<\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u6253\u958b Gitlab\u4ecb\u9762<\/li><li>\u9032\u5230 \u500b\u4eba\u8cc7\u6599\u8a2d\u7f6e profile \u4ecb\u9762<\/li><li>\u9078\u64c7 SSH Keys \u5c07\u5167\u5bb9\u8cbc\u5230 Key \u88e1\u9762\u4e26\u6309 Add Key \u6309\u9215<\/li><li>\u5b8c\u6210 SSH Key \u7d81\u5b9a\u52d5\u4f5c<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>cat ~\/.ssh\/id_rsa.pub \u6216 pbcopy &lt; ~\/.ssh\/id_rsa.pub\n\/*****************\u62f7\u8c9dsshkey*****************\/\nssh-rsa \n........\ngit@gitlab.com:jilinjob\/myproject.git\n\/*****************\u62f7\u8c9dsshkey.end*****************\/<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3. git clone &lt; repo URL &gt;  \u4e0b\u8f09\u5c08\u6848<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/myproject\ngit clone git@gitlab.com:jilinjob\/myproject.git\n\nCloning into 'myproject'...\nThe authenticity of host 'gitlab.com (35.231.145.151)' can't be established.\nECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.\nAre you sure you want to continue connecting (yes\/no)? yes\nWarning: Permanently added 'gitlab.com,35.231.145.151' (ECDSA) to the list of known hosts.\nwarning: You appear to have cloned an empty repository.<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">4.git push  \u4e0a\u50b3\u5c08\u6848<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>cd myproject\ngit status\n\ngit init \ngit remote add origin git@gitlab.com:&#91;gitname].git\ngit add .\ngit commit -m \"Initial commit\"\ngit push -u origin master<\/code><\/pre>\n\n\n\n<p>\u51fa\u73fe\u8a0a\u606f: Permission denied (publickey)  <a href=\"http:\/\/jilin.hydesign.tw\/index.php\/2020\/03\/03\/git-permission\/\">\u9023\u7d50\u89e3\u6c7a\u65b9\u5f0f<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u8a3b\u518aGitlab\u5e33\u865f https:\/\/gitlab.com\/ 2. SSH KEY\u8a2d\u5b9a \u5275\u5efaSSH Ke&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,4],"tags":[],"class_list":["post-1913","post","type-post","status-publish","format-standard","hentry","category-git","category-notes"],"_links":{"self":[{"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/posts\/1913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/comments?post=1913"}],"version-history":[{"count":44,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/posts\/1913\/revisions"}],"predecessor-version":[{"id":7404,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/posts\/1913\/revisions\/7404"}],"wp:attachment":[{"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/media?parent=1913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/categories?post=1913"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jilin.hydesign.tw\/index.php\/wp-json\/wp\/v2\/tags?post=1913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}