栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

git 操作记录

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/320181.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号