我可以推但不能拉git [英] I can push but not pull git

查看:182
本文介绍了我可以推但不能拉git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在Gitlab上创建了一个新的git repo.

I just created a new git repo on Gitlab.

我以以下方式初始化并推送了一个已经填充的目录:

I init and pushed an already populated directory in the following manner:

git init
git remote add origin git@gitlab.com:username/reponame.git
git add .
git commit -m 'first commit'

git push -u origin master

所有操作均按预期进行.但是,当我尝试从回购中撤出时,我得到了

All worked as expected. However, when I try to pull back from the repo i get

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

出现此错误的原因:

git pull
git fetch

它不会出现在:

git push

Push运行正常,我已经进行了几次推送,进行了一些更改...

Push is working fine, I have made several pushed several changes...

最初,我确实几次错误地输入了ssh密码,并首先尝试推送一个空的存储库.

I did initially get my ssh password wrong a few times and attempted at first to push an empty repo.

这是怎么了?

推荐答案

好的,它出现了.

Git初始化生成了一个属于root的FETCH_HEAD文件.其余的.git/是我的用户.

Git init generated a FETCH_HEAD file that belonged to root. The rest of .git/ was my users.

我不得不将文件的所有权更改为我的用户,然后问题解决了.

I had to change the ownership of the file to my user an then the problem resolved.

为什么不是简单地拒绝我访问我不知道的文件的权限.

Why it was not simply refusing me permission to access the file I do not know.

这篇关于我可以推但不能拉git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆