久久一次換新電腦,要重新設定git環境,紀錄一下日後可以查找
設定ssh
- 使用ssh-keygen
D:\>ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (C:\Users\itlogs/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in C:\Users\itlogs/.ssh/id_rsa. Your public key has been saved in C:\Users\itlogs/.ssh/id_rsa.pub. The key fingerprint is: SHA256:xxxxx The key's randomart image is: +---[RSA 2048]----+ | .o++o| | .. o+=| | .= . . | | o+o | +----[SHA256]-----+
- 產出了路徑會在 C:\Users\user-name/.ssh/
- 設定git使用windows的憑證存放區設定
git config --global http.sslBackend schannel
- gitlab設定: user > setting > ssh keys 加入public key (id_rsa.pub)
- 取一個遠端數據庫的名稱
git remote add <name> <url> git remote add itlogs https://xxx@gitlab.com/xxx/test.git
推上去
git push <repository> <refspec> git push itlogs master
拉下來
git pull <repository> <refspec> git pull itlogs master
- clone
git clone <repository> <directory> git clone https://xxx@gitlab.com/xxx/test.git test
- 使用ssh-keygen
No comments:
Post a Comment