为什么`git pull`在我的网络服务器上失败? [英] Why does `git pull` fail on my webserver?

查看:126
本文介绍了为什么`git pull`在我的网络服务器上失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用git提取网站代码库中的更改。文件内部的更改和文件的删除是可行的,但是,当我向存储库添加新文件或目录(非空文件)时,不会将其本地拉到Web服务器,在拉出时不显示任何错误消息,但是在检查该文件时,它不在那里。

I use git to pull changes os a site's code base. The changes inside files and deletion of files works, however, when I add new files or directories (not empty ones) to the repo, it wont get pulled locally to the webserver, when pulling no error message is displayed but when checking for that file, it is not there. Online at the bitbucket repo it is shown.

试图删除本地git repo并再次克隆它,这样我可以从源中获取所有文件,但是问题仍然存在对新添加的文件进行拉取时。它显示出好像被拉的东西:

Tried to delete the local git repo and clone it again, this way I get all the files from origin, but the problem persist when doing a pull for newly added file. It shows as if its pulled:

...
   18bb8ac..c9c1e40  master     -> origin/master
Updating 18bb8ac..c9c1e40
Fast-forward
 config/plugins/test1.txt   | 22 ++++++++++++++++++++++
 config/plugins/testing.txt | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 config/plugins/test1.txt
 create mode 100644 config/plugins/testing.txt

但是在检查时( ls -la config / plugins / ),新文件不存在。即使我尝试使用 sudo git pull

But when checking (ls -la config/plugins/), the new files are not there. Even if I try the pull with sudo git pull.

我也尽力了,但是之后我做不了除非我删除了整个本地存储库并再次克隆它,否则文件将出现。没有硬重置,似乎没有任何帮助。

I tried hard but after this I couldn't make the file appear unless I removed the whole local repo and cloned it again. No hard reset, nothing seems to help.

我所做的检查:


  • 确保实际上在有关文件上保存了更改。

  • 确保文件不符合我在.gitignore和.git / info / exclude中的排除规则

  • 确保不尝试添加空文件夹。 Git不会跟踪这些。

我在网络服务器上此存储库的权限设置基于:
https://www.agix.com.au/git-a- sysadmin演练/

My permission settings for this repo on the webserver was based on: https://www.agix.com.au/git-a-walk-through-for-sysadmins/

因此它是:

sudo chown apache:apache -R /var/www/html/sites/mysite
cd /var/www/html/sites/mysite
# File permissions, recursive
sudo find . -type f -exec chmod 0644 {} \;
# Dir permissions, recursive
sudo find . -type d -exec chmod 0755 {} \;
sudo setfacl -R -b -m user:root:rwx -m d:user:root:rwx -m group:developers:rwx -m d:group:developers:rwx -m group:apache:rx -m d:user:apache:rx /var/www/html/sites/mysite

我在开发人员组中的用户。

My user in the developer's group.

这是我的 .git 服务器上的目录。

Here is my .git directory from the server.

我正在使用CentOS7和git 2.16.3。

I'm using CentOS7 and git 2.16.3.

推荐答案

将文件拖到同一台服务器上的其他存储库中是可行的,因此我完全删除了此有问题的存储库的远程存储库和本地.git目录,并创建了一个新的远程存储库,并将其添加到现有文件中。只有这样才能解决问题。

Pulling files to other repos on the same server worked so I deleted this problematic repo's remote repository completely and the local .git directory and created a new remote repo and added to it the existing files. Only this have solved the issue.

希望下次如果问题再次出现,我可以用更多线索来更新此答案,以了解我对回购交易所做的处理发疯。

Hopefully next time if the problem rises again I can update this answer with more clues as to what I did with the repo that made it to go nuts.

这篇关于为什么`git pull`在我的网络服务器上失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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