Git首次配置遠程倉庫

1.配置全局用戶名和郵箱

  1. git config --global user.name "shanyouyan"
  2. git config --global user.email "xxx@qq.com"

2.配置密鑰

  1. ssh-keygen -t rsa -C "shanyouyan@outlook.com"
  2. cat ~/.ssh/id_rsa.pub

image
將獲得的密鑰配置到遠程倉庫的SSH Keys中
image
imagegit

3.創建倉庫

1.初始化倉庫

1.git initgithub

2.放入暫存區並提交到本地

1.git add . (表示暫存全部文件)
2.git add 某個文件名稱ssh


若是出現:warning: LF will be replaced by CRLF in 'xxx' 錯誤時,緣由是由於Windows和Linux提交時的換行符不同,解決方法:spa

git config --global core.autocwenrlf false

3.code

git commit -m"第一次提交"
git remote add origin git@github.com:shanyouyan/shopMall.git

4.rem

git push (-u) origin master
若是出現身份驗證的錯誤,fatal: Authentication failed for 'http://xxx/'
使用命令:git push --set-upstream origin master

5.git配置記住用戶名和密碼:it

git config --global credential.helper store
相關文章
相關標籤/搜索