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