這幾天要PUSH代碼到GITHUB,發現之前用的密碼方式被取消了,需改成SSH KEY的方式。
1.生成SSH-KEY
ssh-keygen
#會產生 ~/.ssh/id_rsa 和 ~/.ssh/id_rsa_pub 文件
#如果是從別的地方拷貝過來的id_rsa,需chmod 400 ~/.ssh/id_rsa更改屬性
2.在github上新建倉庫
https://github.com/paulwong888/python-ai
3.導入公鑰到github
打開你的SSH公鑰文件,通常位于~/.ssh/id_rsa.pub。復制公鑰內容,然后登錄到你的GitHub賬戶,進入Settings > SSH and GPG keys,點擊"New SSH key"按鈕,粘貼你的公鑰,然后點擊"Add SSH key"。
4.克隆倉庫
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
git clone git@github.com:paulwong888/python-ai
5.導入project到eclipse
上步克隆時已經在本地新建了一個本地倉庫,Import->Git->Project from Git->Existing local repository,選擇python-ai/.git文件夾
之后的操作和用密碼的方式是一樣的。