美文网首页
git错误集合

git错误集合

作者: Mandy_Wang | 来源:发表于2021-03-26 13:23 被阅读0次

再好的记忆也经不起时间的推敲 记录是最好的良药

使用git时经常会遇到问题 有时候搜到了解决方案 下次的时候还是会遇到 所以今天开始记录一下每次使用时的问题 加深印象


1. gitee推送到远程仓库时提示错误

remote: Incorrect username or password ( access token )
fatal: Authentication failed for 'https://gitee.com/***/***.git/'
# 输入
git config --system --unset credential.helper

2. 问题:push 分支dev 时遇到问题

# 问题
To https://gitee.com/Mandy_wang/mandy_wang.git
 ! [rejected]        dev -> dev (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/Mandy_wang/mandy_wang.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
#解决
git checkout origin/dev //切换远程分支
git fetch origin dev // 获取远程dev分支的修改
git merge origin dev //合并远程分支 dev
git pull origin dev //更新本地的代码

3. 没有保存本地修改 就去pull

# 问题
error: The following untracked working tree files would be overwritten by merge:
# 解决办法
git stash
git pull
git stash pop

4. 本地回滚了版本 再次push时遇到的问题

#问题: 
To https://gitee.com/Mandy_wang/mandy_wang.git
 ! [rejected]        dev -> dev (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/Mandy_wang/mandy_wang.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
# 解决办法
git push origin dev -f // 强制让本地分支覆盖远程分支

5. 其他

git status  // 查看工作状态
git branch -a // 查看所有分支
git log // 查看版本号
git log --pretty = online // 美化显示
git reset –-hard HEAD ^   // ( ^ 表示回到上一个版本)
git reset --hard HEAD ^^ // 上上个版本
git reset –-hard 版本号 // 回退后想恢复原来的使用

git clean -f -n:查看会删除哪些文件
git clean -f:删除上一条命令显示出来的文件
git clean -fd:删除文件夹
git clean -fX:删除已被忽略的文件
git clean -fx:删除已被忽略和未被忽略的文件

相关文章

  • git错误集合

    再好的记忆也经不起时间的推敲 记录是最好的良药 使用git时经常会遇到问题 有时候搜到了解决方案 下次的时候还是会...

  • git错误集合

    1. Authentication failed for 原因: 此错误造成原因是登录git账号时用户名或者密码错...

  • 错误集合

    Commit failed with error: did not match any file(s) known...

  • 错误集合

    1.dyld: Library not loaded: @rpath/libswiftCore.dylib R...

  • 错误集合

    1 我的代码错误原因

  • 错误集合

    CocoaPods报错:The dependency AFNetworking is not used in an...

  • 错误集合

    错误一:英文描述 中文描述:大体意思就是这个App缺少一个获取私有(敏感)数据的权限描述,需要我们在info.pl...

  • 错误集合

    1、composer 报 Failed to decode response: zlib_decode(): da...

  • 错误集合

    spring boot 解决后台返回 json 到前台出现中文乱码的问题 微信 登录 Scope 参数错误或没有 ...

  • 错误集合

    MAC,IDEA运行 Test 发生错误 解决办法:1、删除缓存 rm -rf ~/Library/Caches/...

网友评论

      本文标题:git错误集合

      本文链接:https://www.haomeiwen.com/subject/hwyjhltx.html