git pull 报错

问题:

1、本地初始化了git仓库,放了一些文件进去并进行了add操作和commit提交操作;

2、github创建了git仓库并建立了README,.gitignore等文件;

3、本地仓库添加了github上的git仓库作为远程仓库,起名origin;

git remote add origin 远程仓库地址

4,本地仓库也远程仓库关联

git branch --set-upstream-to=origin/master master
这个时候就出现了

解决问题:

如果直接pull,就会出现

refusing to merge unrelated histories
的错误,正确姿势:

git pull origin master --allow-unrelated-histories
然后本地远程仓库关联

git branch --set-upstream-to=origin/master master
最后就可以push了;

总结一下:本地仓库有文件,远程仓库也有文件,正确姿势:

1,git remote add origin 远程仓库地址

2,git pull origin master --allow-unrelated-histories

3,git branch --set-upstream-to=origin/master master

4,git push

原文地址:https://www.cnblogs.com/whm-blog/p/11691015.html

时间: 2024-10-11 16:16:43

git pull 报错的相关文章

git pull 报错 You have not concluded your merge (MERGE_HEAD exists).

git pull时报错 解决方案: 原文地址:https://www.cnblogs.com/zacky31/p/8659155.html

git bash提交代码过程 以及 git pull报错 your local changes to the following files would be overwritten by merge:

git bash 平常提交代码流程: 1. 在文件根目录下鼠标右键点击空白处,选择git Base here 2. git status 查看哪些文件被修改,文件状态为 modified, 也就是被修改了,“Changes not stagged for commit”表示文件被修改但是提交前还没有被存储 3. git add 将修改添加到暂存区(git commit之前必须要执行这一步) git add . : 是将所有被修改的文件和新增加的文件,但不包括被删除的文件 添加到缓存区 git a

解决git pull报错的方法

第1个问题: 解决GIT代码仓库不同步 今天在执行git pull时出现: [[email protected] /data/work/www/rest/lib/Business/Inventory]# git pull Enter passphrase for key '/root/.ssh/id_rsa': Updating 70e8b93..a0f1a6c error: Your local changes to the following files would be overwritt

Eclipse git pull 报Nothing to fetch 异常原因

eclipse git pull 报错// 使用这个配置会有 org.eclipse.jgit.api.errors.TransportException: Nothing to fetch. 异常[core]    repositoryformatversion = 0    filemode = false    logallrefupdates = true[branch "master"]         remote = origin         merge = refs

git push报错error: failed to push some refs to '[email protected]:

$ git push -u origin master To [email protected]:xxx/xxx.git ! [rejected] master -> master (fetch first) error: failed to push some refs to '[email protected]:xxx/xxx.git' hint: Updates were rejected because the remote contains work that you do hint:

git push 报错:failed to push some refs to '[email protected]:devops/thor.git'

error: failed to push some refs to '[email protected]:devops/thor.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

<问题解决02>Linux虚拟机使用git push报错--解决方案如下:

问题描述: 使用git push 报错: error: The requested URL returned error: 403 Forbidden while accessing https://github.com/Newlyfly/Hello_World.git/info/refs fatal: HTTP request failed 解决方案: 解决方案来源博客地址:http://blog.csdn.net/happyteafriends/article/details/1155404

git checkout 报错 refname 'origin/branch-name' is ambiguous

When this happened, it created the file .git/refs/heads/origin/branch-name. So, I just deleted the file. 执行 rm .git/refs/heads/origin/分支名 再checkout git checkout 报错 refname 'origin/branch-name' is ambiguous 原文地址:https://www.cnblogs.com/cheng6018/p/847

git提交报错SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

git push报错 git push origin master [email protected] /e/git/ouyida3/ouyida3.github.io (master) $ git push origin master fatal: unable to access 'https://github.com/ouyida3/ouyida3.github.io.git/': err or:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tl