zoukankan      html  css  js  c++  java
  • Git遇到的问题记录贴

    1、本地仓库在想做同步远程仓库到本地为之后本地仓库推送到远程仓库做准备时报错了,错误如下:

    fatal: refusing to merge unrelated histories

    解决

    出现这个问题的最主要原因还是在于本地仓库和远程仓库实际上是独立的两个仓库。假如我之前是直接clone的方式在本地建立起远程github仓库的克隆本地仓库就不会有这问题了。

    查阅了一下资料,发现可以在pull命令后紧接着使用--allow-unrelated-history选项来解决问题(该选项可以合并两个独立启动仓库的历史)。

    命令:

    git pull origin master --allow-unrelated-histories

    2、当使用Git进行代码push提交时,出现报错信息“fatal: 'origin' does not appear to be a git repository...”,

    $ git push -u origin master
    fatal: 'origin' does not appear to be a git repository
    fatal: Could not read from remote repository.

    是因为远程不存在origin这个仓库名称,可以使用如下操作方法,查看远程仓库名称以及路径相关信息,可以删除错误的远程仓库名称,重新添加新的远程仓库;

    git remote -v:                                           查看远程仓库详细信息,可以看到仓库名称

    git remote remove orign:                        删除orign仓库(如果把origin拼写成orign,删除错误名称仓库)

    git remote add origin 仓库地址:              重新添加远程仓库地址

    gti push -u origin master:                       提交到远程仓库的master主干

     

    3、git pull时,遇到错误: fatal: refusing to merge unrelated histories解决

     

    原因:上网查到原因是两个分支是两个不同的版本,具有不同的提交历史

    解决:

     

    $git pull origin master --allow-unrelated-histories

     

    4、gitignore忽略目录或文件

    想忽略某个文件夹,但又不想忽略这个文件夹下的某个子目录?

    # you can skip this first one if it is not already excluded by prior patterns
    !application/
     
    application/*
    !application/language/
     
    application/language/*
    !application/language/gr/
    

      

    5、阿里云(code.aliyun)使用https方式(账号密码)拉取代码报:

    1 error prohibited this user from being saved: 
          Reset password token is inval

    按照字面意思就是我输入的令牌无效,坑就坑在这里,它只给你提示令牌无效,不告诉你是什么原因。

    然后我想应该是格式不对,尝试了随便输入6位的数字,又提示下面的错误

    1 error prohibited this user from being saved: 
          Password is too short (minimum is 8 characters

    现在有些明白了,不能低于八位数字,于是我就尝试修改为8位以上的纯数字,ok通过。(摘自:https://blog.csdn.net/c_o_d_e_/article/details/108181049)

    6、pycharm添加git ignore

    pycharm现在提供了git ignore,很方便

    从这里下载扩展:https://plugins.jetbrains.com/plugin/7495--ignore

    然后在project中,项目名上点右键,add,ignore file,gitignore就可以了

     

  • 相关阅读:
    【视频开发】图像清晰度评价方法
    【视频开发】图像清晰度评价方法
    【VS开发】MFC修改Opencv namedWindow的风格
    【VS开发】MFC修改Opencv namedWindow的风格
    【ARM-Linux开发】ctrl-xxx的对应的signal含义
    【ARM-Linux开发】ctrl-xxx的对应的signal含义
    【VS开发】程序如何捕捉signal函数参数中指定的信号
    【VS开发】程序如何捕捉signal函数参数中指定的信号
    【VS开发】windows下的signal
    【VS开发】windows下的signal
  • 原文地址:https://www.cnblogs.com/Denny_Yang/p/14706324.html
Copyright © 2011-2022 走看看