準備:PyCharm、GitHub賬號、Git安裝配置完成
步驟:
1、安裝PyCharm、註冊GitHub賬號
2、下載git(地址:https://git-scm.com/)
3、配置git bash:
# name 爲GitHub用戶名,email 爲GitHub註冊郵箱
$ git config --global user.name "name"
$ git config --global user.email "email"
$ ssh-keygen -t rsa -C "email" # 生成ssh key 公鑰
4、在GitHub上添加生成的公鑰:
登錄GitHub,點擊頭像->Setting,再選擇SSH and GPG keys
選擇New SSH key
複製粘貼剛纔生成的key,用命令cat ~/.ssh/id_rsa.pub查看
5、配置PyCharm:
file->setting,打開配置菜單,選擇Version Control,選擇GitHub
輸入自己的GitHub賬號和密碼,選擇ssh驗證,也可不選,看自己需要。
再繼續選擇菜單欄的Git選項,配置git地址
6、上傳項目到GitHub:
在PyCharm選擇VCS->import into version Control->share project on github
分別填入項目名、git倉庫名和描述,點擊share:
選擇要上傳的文件即可。