VSCode/VSCode/git配置笔记.txt

55 lines
1.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

touch README.md
git init
git checkout -b main
git add README.md
git commit -m "first commit"
git remote add origin http://43.138.57.202:3000/JIAL/VSCode.git
git push -u origin main
git config --global user.name "JIAL"
git config --global user.email "2287346125@qq.com"
git add . //添加所有文件到仓库
添加所有文件到缓冲区(从目前掌握的水平看,和后面加“.”的区别在于加all可以添加被手动删除的文件而加“.”不行):
git add .
git add --all
提交:提缓冲区的所有修改文件到仓库(如果修改了文件但是没有到仓库,是不会被提交的)
git commit -m "提交的说明"
推送到远程分支origin后面跟自己的分支
git push origin main
error: src refspec master does not match any
检查自己的分支名,不能推送给其他分支
新建仓库
git init
git checkout -b main
git remote add origin http://43.138.57.202:3000/JIAL/VSCode.git
git config --global user.name "JIAL"
git config --global user.email "2287346125@qq.com"
然后就可以拉取文件或者直接打开git仓库克隆
git 中,有时在使用以下命令行时
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
报下面的错误:
warning: user.name has multiple values
error: cannot overwrite multiple values with a single value
Use a regexp, --add or --replace-all to change user.name.
我们用命令
git config --list// 这条指令可以查看到 git 相关配置信息,可以看到已经无意间添加了多个 name 值
这时发现是因为user.name有多个值导致的
解决方法:
$ git config --global --replace-all user.name "你的 git 的名称"
$ git config --global --replace-all uesr.email "你的 git 的邮箱"
做完这一步,再键入 $ git config --list 会发现 name 和 email 只有一个值了,这时候就不会报错了。