How to push different README.md from one working directory to two repositories using git












1















I'd like to push from one working directory to two repositories (Github on WAN and Gitbucket on LAN) using git.



I'd like to make the content to be pushed slightly different.
For example;
I want to make README.md separate.
Also, I do not want to push a file to one repository and push it to the other repository.
What kind of method do you have?










share|improve this question























  • You will have to create two working directories (two .git folder + two .gitignore) and keep moving them into and out of the repo directory. It's a bit tedious. You could have two branches with the changes you wish to have, and use git submodule to track them in two different repos. I guess that would work.

    – clmno
    Nov 16 '18 at 4:15











  • Thank you. I will examine git submodule.

    – keides2
    Nov 17 '18 at 16:00
















1















I'd like to push from one working directory to two repositories (Github on WAN and Gitbucket on LAN) using git.



I'd like to make the content to be pushed slightly different.
For example;
I want to make README.md separate.
Also, I do not want to push a file to one repository and push it to the other repository.
What kind of method do you have?










share|improve this question























  • You will have to create two working directories (two .git folder + two .gitignore) and keep moving them into and out of the repo directory. It's a bit tedious. You could have two branches with the changes you wish to have, and use git submodule to track them in two different repos. I guess that would work.

    – clmno
    Nov 16 '18 at 4:15











  • Thank you. I will examine git submodule.

    – keides2
    Nov 17 '18 at 16:00














1












1








1


1






I'd like to push from one working directory to two repositories (Github on WAN and Gitbucket on LAN) using git.



I'd like to make the content to be pushed slightly different.
For example;
I want to make README.md separate.
Also, I do not want to push a file to one repository and push it to the other repository.
What kind of method do you have?










share|improve this question














I'd like to push from one working directory to two repositories (Github on WAN and Gitbucket on LAN) using git.



I'd like to make the content to be pushed slightly different.
For example;
I want to make README.md separate.
Also, I do not want to push a file to one repository and push it to the other repository.
What kind of method do you have?







git github






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 2:07









keides2keides2

184




184













  • You will have to create two working directories (two .git folder + two .gitignore) and keep moving them into and out of the repo directory. It's a bit tedious. You could have two branches with the changes you wish to have, and use git submodule to track them in two different repos. I guess that would work.

    – clmno
    Nov 16 '18 at 4:15











  • Thank you. I will examine git submodule.

    – keides2
    Nov 17 '18 at 16:00



















  • You will have to create two working directories (two .git folder + two .gitignore) and keep moving them into and out of the repo directory. It's a bit tedious. You could have two branches with the changes you wish to have, and use git submodule to track them in two different repos. I guess that would work.

    – clmno
    Nov 16 '18 at 4:15











  • Thank you. I will examine git submodule.

    – keides2
    Nov 17 '18 at 16:00

















You will have to create two working directories (two .git folder + two .gitignore) and keep moving them into and out of the repo directory. It's a bit tedious. You could have two branches with the changes you wish to have, and use git submodule to track them in two different repos. I guess that would work.

– clmno
Nov 16 '18 at 4:15





You will have to create two working directories (two .git folder + two .gitignore) and keep moving them into and out of the repo directory. It's a bit tedious. You could have two branches with the changes you wish to have, and use git submodule to track them in two different repos. I guess that would work.

– clmno
Nov 16 '18 at 4:15













Thank you. I will examine git submodule.

– keides2
Nov 17 '18 at 16:00





Thank you. I will examine git submodule.

– keides2
Nov 17 '18 at 16:00












1 Answer
1






active

oldest

votes


















0














First, I would also recommend having two separate working directories, each with their own remote repo URL as "origin".

Trying to do everything in one repo is error-prone: you will make a mistake at some point, and push the wrong file or content to the wrong remote.



Second, you can do a




  • push from your first local repo to your second local repo, and

  • add in your second local repo a post-receive hook where you can script the changes you need in said second repo: amend of the README content, deletion of a file.

    That same hook, automatically trigger by your push, can itself triggers a push to your second remote repo. With the right content.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2fstackoverflow.com%2fquestions%2f53330457%2fhow-to-push-different-readme-md-from-one-working-directory-to-two-repositories-u%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









    0














    First, I would also recommend having two separate working directories, each with their own remote repo URL as "origin".

    Trying to do everything in one repo is error-prone: you will make a mistake at some point, and push the wrong file or content to the wrong remote.



    Second, you can do a




    • push from your first local repo to your second local repo, and

    • add in your second local repo a post-receive hook where you can script the changes you need in said second repo: amend of the README content, deletion of a file.

      That same hook, automatically trigger by your push, can itself triggers a push to your second remote repo. With the right content.






    share|improve this answer




























      0














      First, I would also recommend having two separate working directories, each with their own remote repo URL as "origin".

      Trying to do everything in one repo is error-prone: you will make a mistake at some point, and push the wrong file or content to the wrong remote.



      Second, you can do a




      • push from your first local repo to your second local repo, and

      • add in your second local repo a post-receive hook where you can script the changes you need in said second repo: amend of the README content, deletion of a file.

        That same hook, automatically trigger by your push, can itself triggers a push to your second remote repo. With the right content.






      share|improve this answer


























        0












        0








        0







        First, I would also recommend having two separate working directories, each with their own remote repo URL as "origin".

        Trying to do everything in one repo is error-prone: you will make a mistake at some point, and push the wrong file or content to the wrong remote.



        Second, you can do a




        • push from your first local repo to your second local repo, and

        • add in your second local repo a post-receive hook where you can script the changes you need in said second repo: amend of the README content, deletion of a file.

          That same hook, automatically trigger by your push, can itself triggers a push to your second remote repo. With the right content.






        share|improve this answer













        First, I would also recommend having two separate working directories, each with their own remote repo URL as "origin".

        Trying to do everything in one repo is error-prone: you will make a mistake at some point, and push the wrong file or content to the wrong remote.



        Second, you can do a




        • push from your first local repo to your second local repo, and

        • add in your second local repo a post-receive hook where you can script the changes you need in said second repo: amend of the README content, deletion of a file.

          That same hook, automatically trigger by your push, can itself triggers a push to your second remote repo. With the right content.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 6:01









        VonCVonC

        837k29426463184




        837k29426463184






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • 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%2fstackoverflow.com%2fquestions%2f53330457%2fhow-to-push-different-readme-md-from-one-working-directory-to-two-repositories-u%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







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini