Git Clone from GitLab
如果你想要抓下gitlab上的專案,做法跟github是一樣的
你需要在gitlab網站上複制你要clone下來的連結
我這裡是用Clone with SSH,指令如下:
git clone git@gitlab.com:myproject/official-website.git
1
但如是你是第一次clone gitlab的專案你可能會得到以下錯誤訊息
Cloning into 'official-website'...
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
1
2
3
4
2
3
4
原因是你必需在gitlab的網站上,加入你目前開發環境的ssh key
那如何產生ssh key呢?
我在mac開發裝置上打開terminal
然後鍵入 ssh-keygen
ssh-keygen
1
接著就會有底下個步驟,你可以都enter跳過
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/rahulwagh/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/rahulwagh/.ssh/id_rsa.
Your public key has been saved in /Users/rahulwagh/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Okq3w+SesCGLQVToSBQru8RdUZtT2EIIrzH5MQ67DWA rahulwagh@local
The key's randomart image is:
+---[RSA 3072]----+
|.ooo..+oo. |
| oo o..o+. |
|=E = = +. |
|*oo X o . |
|.+ = o S |
|o. + .. |
|o ..+=+ |
| o + *++ |
|. . o.+. |
+----[SHA256]-----+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
接下來你就可以在 /Users/ray/.ssh/ 路徑下找到 id_rsa.pub 這個ssh publick key file
然後把這檔案的內容複製下來貼在gitlab - ssh keys
然後再重新執行一次 git clone 專案路徑
就可以啦
最後更新時間: 2021/06/15, 08:16:58