Git推程式碼拉程式碼以及SSH配置
阿新 • • 發佈:2022-04-01
一.設定Git的user.name和user.email
先查詢有本地的user.name和user.email,
git config --global user.name 'xxxx'
git config --global user.email 'xxxx'
如果想修改已存在的user.name和user.email
git config --global --replace-all user.name 'xxxx'
git config --global --replace-all user.email 'xxx'
二,檢查本地是否存在SSH
cd ~/.ssh ls或者ll//看本地是否存在id_rsa和id_rsa.pub檔案,如果存在,說明已經有SSH Key
三,獲取SSH Key
cat id_rsa.pub //拷貝祕鑰ssh-rsa開頭,新增到下一步的GitHub配置中
四,GitHub新增SSH Key
將上一步的SSH Key新增到這的key輸入框裡,titile值隨意寫,這樣就新增成功了
五,推送拉取程式碼
git init git add . git commit -m '描述資訊' git remote remote add origin '遠端倉庫名' git push -u origin master//推送master分支到遠端,如果切換分支推送的話 git branch develop git push -u origin develop //推送develop分支到遠端