你如何处理git中的文件所有权? [英] How do you deal with file ownership in git?

查看:97
本文介绍了你如何处理git中的文件所有权?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个嵌入式Linux项目。我们的构建过程使得图像闪现到设备中。我们的许多文件需要root权限才能使系统正常工作。当我尝试拉动并修改其中一些文件时,我遇到了一个问题 - git无法写入这些文件,因此很难重置并执行sudo pull。然后,当我切换分支时,它说所有这些文件都无法取消链接...,但无论如何它都会切换分支,然后当我尝试切换回分支时,它不会让我因为我本地进行更改。 / p>

所以我没有做正确的事情;什么是正确的方式来处理这个问题?

解决方案

我会构建您的系统,以便源文件不关心什么他们是老板。你可以检查这些进出git,而不用担心他们拥有什么权限或者拥有者是谁(尤其是因为所有者在git部署可能服务的所有系统中没有意义)。



如果您想生成嵌入式图像,请将所有内容复制到新目录中,然后然后根据需要设置权限。


I'm working on an embedded Linux project. Our build process makes an image that gets flashed to a device. Many of our files require root ownership for the system to work correctly. I ran into a problem when I tried to pull and some of those files were modified - git couldn't write those files, so did reset hard and did sudo pull. Then when I switched branches, it said "unable to unlink..." for all those files, but it switched branches anyway, then when I tried to switch back to the branch it wouldn't let me because I had local changes.

So I'm not doing something right; what is the correct way to deal with this?

解决方案

I would structure your system so that the source files don't care what owner they are. You can check these in and out of git without worrying what permissions they have or who the owner is (especially since "owner" isn't meaningful across all the systems a git deployment is likely to serve).

When you want to generate the embedded image, copy everything to a new directory and then set the permissions as you need.

这篇关于你如何处理git中的文件所有权?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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