欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

git常见问题

程序员文章站 2022-07-07 20:59:02
...

一、clone代码

  1. clone

     1.登录账号密码不对
     fatal: Authentication failed for
     2.权限不足
     Permission denied (publickey)
     或者emote: User permission denied fatal: unable to access url The requested URL returned error: 403
    

二、合并分支提交代码

  1. 合并

     Push rejected: Push master to origin/master was rejected by remote		提交备注格式不对会拒绝
    
     解决方法:
    

    git log查看提交记录

    git常见问题

    回退到上个提交版本号 比如说这次提交的是不能push到远程仓库的 就回退到

     git reset --soft e5463abfc600dac9b98c3541d1af56cc7fbf97c8
     (不加--soft 会删除掉本地代码)
    
  2. pull 代码冲突

     Git Pull Failed
     You have not concluded your merge (MERGE_HEAD exists).
     Exiting because of unfinished merge.
    

    解决办法:

     方法一:
     git reset --merge
     注:取消合并
     方法二:
     git add
    
     注:追加修改后的文件
     方法三:
     git commit --amend
    
     注:提交修改后的代码
     方法四:
     git push +分支
    
     注:提交到某个分支中
    
  3. push不上去

    1.问题:

     提示Could Not Merge origin/master: You have not concluded your merge (MERGE_HEAD exists).
     强行拉去合并不推荐。最好本地commit、 merge、然后pull然后push
     git pull origin master --allow-unrelated-histories
    

转载于:https://my.oschina.net/u/3730149/blog/3074956