关于前端:Git首次配置远程仓库

0次阅读

共计 612 个字符,预计需要花费 2 分钟才能阅读完成。

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


将失去的密钥配置到近程仓库的 SSH Keys 中

3. 建设仓库

1. 初始化仓库

1.git init

2. 放入暂存区并提交到本地

1.git add . (示意暂存所有文件)
2.git add 某个文件名称


如果呈现:warning: LF will be replaced by CRLF in ‘xxx’ 谬误时,起因是因为 Windows 和 Linux 提交时的换行符不一样,解决办法:

git config --global core.autocwenrlf false

3.

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

4.

git push (-u) origin master
 如果呈现身份验证的谬误,fatal: Authentication failed for 'http://xxx/'
应用命令:git push --set-upstream origin master

5.git 配置记住用户名和明码:

git config --global credential.helper store
正文完
 0