繁体   English   中英

不能推或拉到Github

[英]Can't push or pull to Github

当我尝试拉动时:

error: cannot open .git/FETCH_HEAD: Permission denied

当我尝试push或push -u origin master

master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com: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.

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

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

从/向github repo拉/推时,这是一个很好的指导:

  1. git stash - 确保您的更改是存储的,并且您的副本将还原为与远程同步的最后一次提交。
  2. git pull - 从远程拉出变化
  3. git stash pop - 将您的更改合并到最新的源代码
  4. git mergetool - 如果存在冲突,则需要在合并更改之前执行此操作。
  5. git commit - 在本地仓库中提交更改
  6. git push - 将您的更改推送到远程。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM