2012-05-04 94 views
2

当我试着拉:不能推或拉至Github上

error: cannot open .git/FETCH_HEAD: Permission denied 

当我尝试推送还是push -u origin master

master -> master (non-fast-forward) 
error: failed to push some refs to '[email protected]:xxxxxxxx/xxxxxxxxxx.git' 
To prevent you from losing history, non-fast-forward updates were rejected 
Merge the remote changes before pushing again. See the 'Note about 
-forwards' section of 'git push --help' for details. 

回答

7

通过“人混帐推”他们阅读提到一个“git pull”应该足以解决这个问题,但是因为你得到了“错误:无法打开.git/FETCH_HEAD:权限被拒绝”,你可能使用sudo创建了分支的克隆?如果是这样,您的文件可能无法被用户读取。仔细检查您的用户帐户是否可以读取.git/FETCH_HEAD文件。

+1

我使用sudo进行克隆,我只是休息一切,并设置一个新的回购。任务完成! – LeBlaireau

3

您的本地副本可能与远程集线器不同步。

这里是一个很好的指引拉/推从/到GitHub库时:

  1. git的藏匿处 - 以确保你的变化是藏匿和你的副本恢复到最后一次提交了在同步与遥控器。
  2. 混帐拉 - 从远程
  3. 混帐藏匿弹出拉的变化 - 将更改合并到最新的源代码
  4. 混帐合并工具 - 如果有冲突,你需要做的这个合并的更改。
  5. git commit - 在您的本地回购中提交您的更改
  6. git push - 将您的更改推送到远程。