Git pull in a Linux environment changes the owner of the filesPermissions issue with gitexplanation on...

How to calculate a conditional PDF in mathematica?

Is it bad to suddenly introduce another element to your fantasy world a good ways into the story?

What does the ash content of broken wheat really mean?

How many spells does my Bard 6/Wizard 1 know?

Was Wolfgang Unzicker the last Amateur GM?

How frequently do Russian people still refer to others by their patronymic (отчество)?

Why did moving the mouse cursor cause Windows 95 to run more quickly?

Why would a propeller have blades of different lengths?

Should I increase my 401k contributions, or increase my mortgage payments

Should I warn my boss I might take sick leave

What units are kpts?

Boss has banned cycling to work because he thinks it's unsafe

How can solar sailed ships be protected from space debris?

What happens if the limit of 4 billion files was exceeded in an ext4 partition?

What is the maximum amount of diamond in one Minecraft game?

CPA filed late returns, stating I would get money; IRS says they were filed too late

Is it possible to spoof an IP address to an exact number?

Will electrically joined dipoles of different lengths, at right angles, behave as a multiband antenna?

How to improve the size of cells in this table?

How might boat designs change in order to allow them to be pulled by dragons?

Interview Question - Card betting

Did Snape really give Umbridge a fake Veritaserum potion that Harry later pretended to drink?

What is exact meaning of “ich wäre gern”?

Minimizing medical costs with HSA



Git pull in a Linux environment changes the owner of the files


Permissions issue with gitexplanation on chown(1) POSIX specEditing Remote Files in Git repoWhy does git store my SSH identity in gnome, but not KDE?Chown for every created file in folderAfter git, folders and files goneGit Bash for both Ubuntu/Linux and Windows requires ssh-agent on restartHow to change the owner and group of a directory by the name of that directory?Git and Git LFS: Doing version tracking on files via a servergit: URL format to access remotely local git server






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







12















Why will every time I execute a git pull on my live server, the owner of the files be changed? I keep on manually doing a chown john:john index.php.



What do I need to change so that, when I do a git pull, the owner of the files will be automatically be or stay john?










share|improve this question




















  • 1





    Is john the owner of the current directory?

    – user000001
    Sep 10 '14 at 17:02











  • Yes, john is the owner of the directory :)

    – PinoyStackOverflower
    Sep 10 '14 at 17:09






  • 1





    Which user running git pull?

    – cuonglm
    Sep 10 '14 at 18:03













  • @Gnouc root user, I am logged in in our live server via SSH as root user :)

    – PinoyStackOverflower
    Sep 11 '14 at 0:40




















12















Why will every time I execute a git pull on my live server, the owner of the files be changed? I keep on manually doing a chown john:john index.php.



What do I need to change so that, when I do a git pull, the owner of the files will be automatically be or stay john?










share|improve this question




















  • 1





    Is john the owner of the current directory?

    – user000001
    Sep 10 '14 at 17:02











  • Yes, john is the owner of the directory :)

    – PinoyStackOverflower
    Sep 10 '14 at 17:09






  • 1





    Which user running git pull?

    – cuonglm
    Sep 10 '14 at 18:03













  • @Gnouc root user, I am logged in in our live server via SSH as root user :)

    – PinoyStackOverflower
    Sep 11 '14 at 0:40
















12












12








12


2






Why will every time I execute a git pull on my live server, the owner of the files be changed? I keep on manually doing a chown john:john index.php.



What do I need to change so that, when I do a git pull, the owner of the files will be automatically be or stay john?










share|improve this question
















Why will every time I execute a git pull on my live server, the owner of the files be changed? I keep on manually doing a chown john:john index.php.



What do I need to change so that, when I do a git pull, the owner of the files will be automatically be or stay john?







git chown






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 11 '18 at 22:21









Jeff Schaller

47.4k11 gold badges69 silver badges154 bronze badges




47.4k11 gold badges69 silver badges154 bronze badges










asked Sep 10 '14 at 16:59









PinoyStackOverflowerPinoyStackOverflower

1731 gold badge1 silver badge7 bronze badges




1731 gold badge1 silver badge7 bronze badges








  • 1





    Is john the owner of the current directory?

    – user000001
    Sep 10 '14 at 17:02











  • Yes, john is the owner of the directory :)

    – PinoyStackOverflower
    Sep 10 '14 at 17:09






  • 1





    Which user running git pull?

    – cuonglm
    Sep 10 '14 at 18:03













  • @Gnouc root user, I am logged in in our live server via SSH as root user :)

    – PinoyStackOverflower
    Sep 11 '14 at 0:40
















  • 1





    Is john the owner of the current directory?

    – user000001
    Sep 10 '14 at 17:02











  • Yes, john is the owner of the directory :)

    – PinoyStackOverflower
    Sep 10 '14 at 17:09






  • 1





    Which user running git pull?

    – cuonglm
    Sep 10 '14 at 18:03













  • @Gnouc root user, I am logged in in our live server via SSH as root user :)

    – PinoyStackOverflower
    Sep 11 '14 at 0:40










1




1





Is john the owner of the current directory?

– user000001
Sep 10 '14 at 17:02





Is john the owner of the current directory?

– user000001
Sep 10 '14 at 17:02













Yes, john is the owner of the directory :)

– PinoyStackOverflower
Sep 10 '14 at 17:09





Yes, john is the owner of the directory :)

– PinoyStackOverflower
Sep 10 '14 at 17:09




1




1





Which user running git pull?

– cuonglm
Sep 10 '14 at 18:03







Which user running git pull?

– cuonglm
Sep 10 '14 at 18:03















@Gnouc root user, I am logged in in our live server via SSH as root user :)

– PinoyStackOverflower
Sep 11 '14 at 0:40







@Gnouc root user, I am logged in in our live server via SSH as root user :)

– PinoyStackOverflower
Sep 11 '14 at 0:40












1 Answer
1






active

oldest

votes


















10














When you use git pull (which is equivalent to git fetch; git merge), git will update files without changing owner (git does not store that information). But if there is new files to create, the current user will be set as the owner.



There is different solution to solve this. The easier is probably to add a post-update hooks (in your .git/hooks directory) to automatically call chown john:john . -R after merge/pull (see that SO solution for an example).



Alternate solutions are:




  • Run git pull as the john user instead of root (that will require write permissions to john for .git directory).

  • Create a hook to make the deployment, which will either use john as user, either do the chown after update (so you will have to do git pull inside the post-receive hook of the bare repo).






share|improve this answer




























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f154859%2fgit-pull-in-a-linux-environment-changes-the-owner-of-the-files%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    10














    When you use git pull (which is equivalent to git fetch; git merge), git will update files without changing owner (git does not store that information). But if there is new files to create, the current user will be set as the owner.



    There is different solution to solve this. The easier is probably to add a post-update hooks (in your .git/hooks directory) to automatically call chown john:john . -R after merge/pull (see that SO solution for an example).



    Alternate solutions are:




    • Run git pull as the john user instead of root (that will require write permissions to john for .git directory).

    • Create a hook to make the deployment, which will either use john as user, either do the chown after update (so you will have to do git pull inside the post-receive hook of the bare repo).






    share|improve this answer






























      10














      When you use git pull (which is equivalent to git fetch; git merge), git will update files without changing owner (git does not store that information). But if there is new files to create, the current user will be set as the owner.



      There is different solution to solve this. The easier is probably to add a post-update hooks (in your .git/hooks directory) to automatically call chown john:john . -R after merge/pull (see that SO solution for an example).



      Alternate solutions are:




      • Run git pull as the john user instead of root (that will require write permissions to john for .git directory).

      • Create a hook to make the deployment, which will either use john as user, either do the chown after update (so you will have to do git pull inside the post-receive hook of the bare repo).






      share|improve this answer




























        10












        10








        10







        When you use git pull (which is equivalent to git fetch; git merge), git will update files without changing owner (git does not store that information). But if there is new files to create, the current user will be set as the owner.



        There is different solution to solve this. The easier is probably to add a post-update hooks (in your .git/hooks directory) to automatically call chown john:john . -R after merge/pull (see that SO solution for an example).



        Alternate solutions are:




        • Run git pull as the john user instead of root (that will require write permissions to john for .git directory).

        • Create a hook to make the deployment, which will either use john as user, either do the chown after update (so you will have to do git pull inside the post-receive hook of the bare repo).






        share|improve this answer















        When you use git pull (which is equivalent to git fetch; git merge), git will update files without changing owner (git does not store that information). But if there is new files to create, the current user will be set as the owner.



        There is different solution to solve this. The easier is probably to add a post-update hooks (in your .git/hooks directory) to automatically call chown john:john . -R after merge/pull (see that SO solution for an example).



        Alternate solutions are:




        • Run git pull as the john user instead of root (that will require write permissions to john for .git directory).

        • Create a hook to make the deployment, which will either use john as user, either do the chown after update (so you will have to do git pull inside the post-receive hook of the bare repo).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 31 mins ago









        Eliah Kagan

        3,2922 gold badges16 silver badges33 bronze badges




        3,2922 gold badges16 silver badges33 bronze badges










        answered Jan 9 '15 at 9:22









        AsenarAsenar

        2312 silver badges6 bronze badges




        2312 silver badges6 bronze badges






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f154859%2fgit-pull-in-a-linux-environment-changes-the-owner-of-the-files%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

            The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

            Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...