git 操作记录

git pull 每次都要求输入用户名和密码

# 全局配置	
git config --global credential.helper store
# 局部配置
git config credential.helper store
# 查看git配置
git config --list

设置用户名和邮箱

# 请替换你的用户名
git config --global user.name "Your Name"
# 请替换你自己的邮箱
git config --global user.email "your@email"

git pull 发生文件冲突

error: Your local changes to the following files would be overwritten by merge:
	public/file/xxx.docx
Please, commit your changes or stash them before you can merge.
Aborting

git reset --hard
git pull

配置ssh秘钥

# 1.创建 SSH 密钥
# 判断是否已经存在本地公钥
cat ~/.ssh/id_rsa.pub
# 如果查询不到本地公钥,你可以按如下命令来生成 SSH 密钥
ssh-keygen -t rsa -C "<邮箱>"

# 复制公钥添加到个人设置 -「SSH 密钥」下,请完整拷贝从 ssh- 开始直到你的用户名和主机名为止的内容。
# 如果打算拷贝公钥到你的粘贴板下,请参考操作系统使用以下命令:
Windows:
clip < ~/.ssh/id_rsa.pub

Mac:
pbcopy < ~/.ssh/id_rsa.pub

GNU/Linux (requires xclip):
xclip -sel clip < ~/.ssh/id_rsa.pub

已有文件夹或者仓库

cd file
git init
git remote add origin xxx.git
git add .
git commit
git push -u origin master

去除版本控制

# -n:加上这个参数,执行命令时,是不会删除任何文件,而是展示此命令要删除的文件列表预览。
git rm -r -n --cached ".vs/" 
# 最终执行命令
git rm -r --cached  ".vs/" 
# 提交
git commit -m "message"
# 提交到远程服务器
git push origin master
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值