今日天气
  1. 博客/

Git 使用问题的记录

·322 字·1 分钟· ·
devops linux git
Johny
作者
Johny
熟练的 云原生搬砖师
Table of Contents

指定特定仓库拉取代码
#

git remote add origin https://github.com/demo/example.git
git pull https://repo.csheidou.com/forestry_afterend/prevention_fire_test.git master
git branch --set-upstream-to=origin/master
git status
git pull 

更改远程仓库地址
#

git remote -v 
git remote set-url origin  https://github.com/demo/example.git
git pull origin master  --allow-unrelated-histories
git push 
git branch --set-upstream-to=origin/master

清理本地错误的用户信息
#

运行一下命令缓存输入的用户名和密码:
git config --global credential.helper wincred

清除掉缓存在git中的用户名和密码
git credential-manager uninstall

解决 Windows git pull 卡住不动问题
#

原因 在 git clone 时后面仓库地址是非公开的 需要验证用户及密码 而windows 默认是已弹窗形式

解决方法:取消窗口拉取

git config --system --unset credential.helper

解决 git 每次 pull/push 多需要输入账号密码问题
#

git config --global credential.helper store

重置 commit id
#

git rebase -i HEAD~3  # 表示需要修改的是最近3次, 此操作会打开一个编辑窗口。 然后按`i`编辑,把 pick 改成 edit,按'Esc'退出编辑,按`:wq`保存退出
git commit --amend -s # 打开刚才更改为 edit 的commit,修改为自己想要的
git rebase --continue 
git log
git push -f

相关文章

OpenVpn 的安装,并配置关联 openLdap 认证
·953 字·2 分钟·
linux network openvpn install
Centos7 执行 shutdown 无法正常关机的解决
·468 字·1 分钟·
linux centos7 shell
Gitlab pre-receive WebHook 的添加与使用
·2219 字·5 分钟·
devops gitlab webhook shell
Gitlab 和 jira 之间的集成
·257 字·1 分钟·
devops jira gitlab
使用 Docker 部署 Gitlab,及常用优化项的说明
·1417 字·3 分钟·
docker docker-compose devops gitlab centos7
Centos 7 Yum 安装 Jenkins 及常用配置的说明
·1419 字·3 分钟·
devops jenkins ci-cd install