• git----在运用git是出现的一些问题整理


    git----在运用git是出现的一些问题整理

    1.Author identity unknown *** Please tell me who you are.
    2.git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.
    3.fatal: detected dubious ownership in repository at …

    1.Author identity unknown *** Please tell me who you are.

    解决方法:下面依次输入

    1. git init
    2. git config --global user.name "git用户名"
    3. git config --global user.email "git登录的邮箱"
    4. git add *
    5. git commit -m “更新信息”
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    2.git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

    解决方法一般是密钥错误,需要重新生成。

    0)在之前先输入命令git config --list查看是否有用户名和邮箱。

    git config --list
    
    • 1

    1)在windows的任意路径打开bash, 然后输入命令ssh-keygen -t rsa -C 邮箱地址**
    默认生成的密钥在/c/Users/用户名/.ssh**

    ssh-keygen -t rsa -C 邮箱地址
    
    • 1

    2) 再次输入命令进行查看:

    cat id_rsa.pub
    
    • 1

    如果出现“cat: id_rsa.pub: No such file or directory“错误要先cd到ssh中 输入cd ~/.ssh,然后再次输入上面的命令行。
    在这里插入图片描述
    在这里插入图片描述
    3)获得key后 复制下来 ,登录github。进入仓库,然后根据下图进行操作。
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    4)添加成功后输入命令 ssh -T git@github.com,出现以下提示就证明ssh配置成功了

     ssh -T git@github.com
    
    • 1

    在这里插入图片描述
    5)在github的code中 选择SSH并复制,并输入命令行(这时候要bash到需要上传的文件): git remote add git@github.com:xxxx/xxx.git

    在这里插入图片描述

     git remote add git@github.com:xxxx/xxx.git
    
    • 1

    如果遇到“fatal: Not a git repository (or any of the parent directories): .git”问题 只需要 重新git init 即可。

    git init
    
    • 1

    之后就会出现下面这样:
    在这里插入图片描述
    6)然后校验是否配置成功,输入 git remote -v 出现以下提示则配置成功

    git remote -v
    
    • 1

    在这里插入图片描述

    3.fatal: detected dubious ownership in repository at

    在这里插入图片描述
    解决方法:注意看红框提示 只需要再输入上面的命令即可

    git config --global --add safe.directory X:xxx/xxx/xxx”
    
    • 1
  • 相关阅读:
    [备忘.Linux]服务部署管理常用命令|systemd
    PG函数中有OUT则忽略 RETURNS SETOF record AS $$
    C#中的浅拷贝与深拷贝
    商业智能BI行业分析思维框架:铅酸蓄电池行业(一)
    恶意代码可视化检测技术研究综述
    Java岗最全面试攻略,吃透25个技术栈,Offer拿到手软,搞定秋招!
    C++ slice类
    基于51单片机八路电压表采集系统波形发生器
    在云时代,我们该如何看待新的开源许可证?
    ssm基于安卓android的失物招领APP-计算机毕业设计
  • 原文地址:https://blog.csdn.net/heavenz19/article/details/126657382