• Git错误汇总


    Git提示rejected

    To github.com:zhuxiaoxi/Web-Demo.git
    ! [rejected] master -> master (fetch first)
    error: failed to push some refs to 'git@github.com:zhuxiaoxi/Web-Demo.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    原因
    远程仓库有一部分代码已经被包含不允许直接推送到远程仓库

    解决方法

    • 在推送时,使用-f选项,强制推送
    git push origin master -f
    

    Git提示remote origin already exists

    fatal: remote origin already exists.

    原因
    已经设置了一个远程仓库,无法设置新的

    解决方法

    • 执行git remote rm origin,再修改远程仓库git remote add origin git@github.com:zhuxiaoxi/dotfiles.git

    Git提示fatal: refusing to merge unrelated histories

    git pull origin master
    From github.com:zhuxiaoxi/dotfiles

    • branch master -> FETCH_HEAD
      fatal: refusing to merge unrelated histories

    解决方法

    • 在拉取时,使用--allow-unrelated-histories选项,忽略无关的历史
    git pull origin master --allow-unrelated-histories
    

    Git提示Please make sure you have the correct access rights

    ssh: Could not resolve hostname origin: Name or service not known
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    解决方法

    # git push origin:peppa 错误,修改为下面的
    git push origin :peppa
    
  • 相关阅读:
    [51单片机] TFT2.4彩屏1 [文字显示 画矩形]
    [51单片机] 中断1-中断整体介绍
    [汇编] 从键盘输入一个一位数字,然后响铃n声
    [汇编] 比较2个字符串是否相等
    [汇编] 将字符串里的一个'&'字符换成空格
    [汇编] 2数相加极简单版
    mysql的IFNULL函数
    mysql 中 unix_timestamp和from_unixtime函数
    Excel实现二级菜单联动
    Hibernate中@Embedded和@Embeddable注解
  • 原文地址:https://www.cnblogs.com/zhuxiaoxi/p/8722852.html
Copyright © 2020-2023  润新知