Using git without internet access

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I want to use version control, but due to security reasons, server I'm working on, has no internet access, I can only move files on usb stick. Can I use git still with it? Can I create small patches that I can apply on git repository?










share|improve this question







New contributor




Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    1
    down vote

    favorite












    I want to use version control, but due to security reasons, server I'm working on, has no internet access, I can only move files on usb stick. Can I use git still with it? Can I create small patches that I can apply on git repository?










    share|improve this question







    New contributor




    Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I want to use version control, but due to security reasons, server I'm working on, has no internet access, I can only move files on usb stick. Can I use git still with it? Can I create small patches that I can apply on git repository?










      share|improve this question







      New contributor




      Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I want to use version control, but due to security reasons, server I'm working on, has no internet access, I can only move files on usb stick. Can I use git still with it? Can I create small patches that I can apply on git repository?







      git






      share|improve this question







      New contributor




      Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      Tutu Kaeen

      61




      61




      New contributor




      Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Tutu Kaeen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          5 Answers
          5






          active

          oldest

          votes

















          up vote
          2
          down vote













          You can use git locally too. Then your commits are only stored locally, you still have a version control with it (and can diff/merge etc.), but you just can't access the repository from any other computer.






          share|improve this answer








          New contributor




          dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.













          • 1




            that I know, but I want to work on another computer and apply it to files on server with no internet access
            – Tutu Kaeen
            55 mins ago

















          up vote
          2
          down vote













          Sure, there's nothing about git that requires a particular protocol. Just out of the box the standard client supports http(s), ssh, the custom git protocol and, importantly, the local protocol. That just takes a path to a local .git directory, which can be within working directory (/path/to/project/.git) or just a bare directory (/path/to/project.git), though the naming is just a convention.



          This means you can, of course, treat add a flash drive as a remote:



          git remote add origin /mnt/flashdrive/foo.git


          or, on Windows:



          git remote add origin F:foo.git


          Or even add it as an additional remote with a different name (if you prefer origin to point towards an internet server somewhere):



          git remote add flashdrive /mnt/flashdrive/foo.git


          Then you can just push/pull to/from this remote just like any other.



          If you read the documentation, you'll notice there's also a file:// protocol that behaves slightly differently. It is recommended to use a local path as that will make use of some additional optimisations - if you use the file:// protocol then git will use some standard network components (to talk to the local disk), which is slower.






          share|improve this answer



























            up vote
            1
            down vote













            You need to first install Git. Then to create a new repository, run within the folder that you've copied:



            git init


            Then you can add files you want to version control by git add (add -a for all files) and start committing the changes (git commit).



            You don't have to push to any remote, as you can work on your local history (git log).



            For more information, check:




            • Git tutorial.


            • git - the simple guide


            Pushing/pulling without internet



            Using git push command, it's possible to push over SSH (using local connection, intranet):



            git remote add server ssh://[user@]host.xz[:port]/path/to/dev/repo.git/
            git push server


            or pushing into the folder:



            git push /mnt/usb/my_repo


            This assumes you've two copies of your repository.



            The same with pulling, e.g.



            git pull /mnt/usb/my_repo


            Patching



            To apply patches, you can use patch command or git apply.



            See: Create patch or diff file from git repository and apply it to another different git repository.






            share|improve this answer





























              up vote
              0
              down vote













              Git is actually really suitable for it, it does not require any internet access at all because all the required information is stored in the .git directory.






              share|improve this answer




















              • but repositories can grow big, is there a more lightweight way than replacing whole .git directory if I want to add commit or two once in a while? Can I "pull" from usb stick?
                – Tutu Kaeen
                56 mins ago










              • I'm pretty sure you will find better answers to those questions if you do a bit of searching online, my git knowledge is quite rusty. I'm fairly certain that it's possible though.
                – JohnEye
                35 mins ago

















              up vote
              0
              down vote













              Method 1: You can create a 'bare repository' on the USB stick, then push to it and pull from it as you would with any other remote repository. In other words, repository operations via local paths aren't any different from operations via SSH or HTTPS URLs.




              1. Create a 'remote' repository:



                $ git init --bare /mnt/Stick/Repositories/Large_Project.git



              2. In computer 1, push everything to it:



                $ cd ~/Large_Project
                $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                $ git push usb master



              3. In computer 2, well, same as always.



                $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                $ git pull usb


              (You can push/fetch/pull from a URL or path directly, too.)




              Method 2: You can create 'transfer bundles' which archive a given list of commits into a single file.



              Unfortunately the bundle commands don't automatically remember what was already bundled the last time, so manual tagging or note-keeping is needed. I'll just take the examples from the git-bundle manual.




              1. In computer 1, create a bundle of the entire branch:



                $ cd ~/Large_Project
                $ git bundle create /mnt/Stick/Project.bundle master
                $ git tag -f last-bundled master



              2. In computer 2, pull from the bundle as if it were a repository:



                $ cd ~/Large_Project
                $ git pull /mnt/Stick/Project.bundle


              Subsequent bundles don't need to pack the whole master – they can pack just the newly added commits from last-bundled..master instead.




              1. In computer 1, create a bundle of the newly added commits:



                $ cd ~/Large_Project
                $ git bundle create /mnt/Stick/Project.bundle last-bundled..master
                $ git tag -f last-bundled master


              2. Same as above.






              share|improve this answer






















                Your Answer







                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "3"
                ;
                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',
                convertImagesToLinks: true,
                noModals: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );






                Tutu Kaeen is a new contributor. Be nice, and check out our Code of Conduct.









                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1367571%2fusing-git-without-internet-access%23new-answer', 'question_page');

                );

                Post as a guest






























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                2
                down vote













                You can use git locally too. Then your commits are only stored locally, you still have a version control with it (and can diff/merge etc.), but you just can't access the repository from any other computer.






                share|improve this answer








                New contributor




                dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.













                • 1




                  that I know, but I want to work on another computer and apply it to files on server with no internet access
                  – Tutu Kaeen
                  55 mins ago














                up vote
                2
                down vote













                You can use git locally too. Then your commits are only stored locally, you still have a version control with it (and can diff/merge etc.), but you just can't access the repository from any other computer.






                share|improve this answer








                New contributor




                dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.













                • 1




                  that I know, but I want to work on another computer and apply it to files on server with no internet access
                  – Tutu Kaeen
                  55 mins ago












                up vote
                2
                down vote










                up vote
                2
                down vote









                You can use git locally too. Then your commits are only stored locally, you still have a version control with it (and can diff/merge etc.), but you just can't access the repository from any other computer.






                share|improve this answer








                New contributor




                dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                You can use git locally too. Then your commits are only stored locally, you still have a version control with it (and can diff/merge etc.), but you just can't access the repository from any other computer.







                share|improve this answer








                New contributor




                dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 58 mins ago









                dhae

                372




                372




                New contributor




                dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                dhae is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.







                • 1




                  that I know, but I want to work on another computer and apply it to files on server with no internet access
                  – Tutu Kaeen
                  55 mins ago












                • 1




                  that I know, but I want to work on another computer and apply it to files on server with no internet access
                  – Tutu Kaeen
                  55 mins ago







                1




                1




                that I know, but I want to work on another computer and apply it to files on server with no internet access
                – Tutu Kaeen
                55 mins ago




                that I know, but I want to work on another computer and apply it to files on server with no internet access
                – Tutu Kaeen
                55 mins ago












                up vote
                2
                down vote













                Sure, there's nothing about git that requires a particular protocol. Just out of the box the standard client supports http(s), ssh, the custom git protocol and, importantly, the local protocol. That just takes a path to a local .git directory, which can be within working directory (/path/to/project/.git) or just a bare directory (/path/to/project.git), though the naming is just a convention.



                This means you can, of course, treat add a flash drive as a remote:



                git remote add origin /mnt/flashdrive/foo.git


                or, on Windows:



                git remote add origin F:foo.git


                Or even add it as an additional remote with a different name (if you prefer origin to point towards an internet server somewhere):



                git remote add flashdrive /mnt/flashdrive/foo.git


                Then you can just push/pull to/from this remote just like any other.



                If you read the documentation, you'll notice there's also a file:// protocol that behaves slightly differently. It is recommended to use a local path as that will make use of some additional optimisations - if you use the file:// protocol then git will use some standard network components (to talk to the local disk), which is slower.






                share|improve this answer
























                  up vote
                  2
                  down vote













                  Sure, there's nothing about git that requires a particular protocol. Just out of the box the standard client supports http(s), ssh, the custom git protocol and, importantly, the local protocol. That just takes a path to a local .git directory, which can be within working directory (/path/to/project/.git) or just a bare directory (/path/to/project.git), though the naming is just a convention.



                  This means you can, of course, treat add a flash drive as a remote:



                  git remote add origin /mnt/flashdrive/foo.git


                  or, on Windows:



                  git remote add origin F:foo.git


                  Or even add it as an additional remote with a different name (if you prefer origin to point towards an internet server somewhere):



                  git remote add flashdrive /mnt/flashdrive/foo.git


                  Then you can just push/pull to/from this remote just like any other.



                  If you read the documentation, you'll notice there's also a file:// protocol that behaves slightly differently. It is recommended to use a local path as that will make use of some additional optimisations - if you use the file:// protocol then git will use some standard network components (to talk to the local disk), which is slower.






                  share|improve this answer






















                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    Sure, there's nothing about git that requires a particular protocol. Just out of the box the standard client supports http(s), ssh, the custom git protocol and, importantly, the local protocol. That just takes a path to a local .git directory, which can be within working directory (/path/to/project/.git) or just a bare directory (/path/to/project.git), though the naming is just a convention.



                    This means you can, of course, treat add a flash drive as a remote:



                    git remote add origin /mnt/flashdrive/foo.git


                    or, on Windows:



                    git remote add origin F:foo.git


                    Or even add it as an additional remote with a different name (if you prefer origin to point towards an internet server somewhere):



                    git remote add flashdrive /mnt/flashdrive/foo.git


                    Then you can just push/pull to/from this remote just like any other.



                    If you read the documentation, you'll notice there's also a file:// protocol that behaves slightly differently. It is recommended to use a local path as that will make use of some additional optimisations - if you use the file:// protocol then git will use some standard network components (to talk to the local disk), which is slower.






                    share|improve this answer












                    Sure, there's nothing about git that requires a particular protocol. Just out of the box the standard client supports http(s), ssh, the custom git protocol and, importantly, the local protocol. That just takes a path to a local .git directory, which can be within working directory (/path/to/project/.git) or just a bare directory (/path/to/project.git), though the naming is just a convention.



                    This means you can, of course, treat add a flash drive as a remote:



                    git remote add origin /mnt/flashdrive/foo.git


                    or, on Windows:



                    git remote add origin F:foo.git


                    Or even add it as an additional remote with a different name (if you prefer origin to point towards an internet server somewhere):



                    git remote add flashdrive /mnt/flashdrive/foo.git


                    Then you can just push/pull to/from this remote just like any other.



                    If you read the documentation, you'll notice there's also a file:// protocol that behaves slightly differently. It is recommended to use a local path as that will make use of some additional optimisations - if you use the file:// protocol then git will use some standard network components (to talk to the local disk), which is slower.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 17 mins ago









                    Bob

                    43.4k19132167




                    43.4k19132167




















                        up vote
                        1
                        down vote













                        You need to first install Git. Then to create a new repository, run within the folder that you've copied:



                        git init


                        Then you can add files you want to version control by git add (add -a for all files) and start committing the changes (git commit).



                        You don't have to push to any remote, as you can work on your local history (git log).



                        For more information, check:




                        • Git tutorial.


                        • git - the simple guide


                        Pushing/pulling without internet



                        Using git push command, it's possible to push over SSH (using local connection, intranet):



                        git remote add server ssh://[user@]host.xz[:port]/path/to/dev/repo.git/
                        git push server


                        or pushing into the folder:



                        git push /mnt/usb/my_repo


                        This assumes you've two copies of your repository.



                        The same with pulling, e.g.



                        git pull /mnt/usb/my_repo


                        Patching



                        To apply patches, you can use patch command or git apply.



                        See: Create patch or diff file from git repository and apply it to another different git repository.






                        share|improve this answer


























                          up vote
                          1
                          down vote













                          You need to first install Git. Then to create a new repository, run within the folder that you've copied:



                          git init


                          Then you can add files you want to version control by git add (add -a for all files) and start committing the changes (git commit).



                          You don't have to push to any remote, as you can work on your local history (git log).



                          For more information, check:




                          • Git tutorial.


                          • git - the simple guide


                          Pushing/pulling without internet



                          Using git push command, it's possible to push over SSH (using local connection, intranet):



                          git remote add server ssh://[user@]host.xz[:port]/path/to/dev/repo.git/
                          git push server


                          or pushing into the folder:



                          git push /mnt/usb/my_repo


                          This assumes you've two copies of your repository.



                          The same with pulling, e.g.



                          git pull /mnt/usb/my_repo


                          Patching



                          To apply patches, you can use patch command or git apply.



                          See: Create patch or diff file from git repository and apply it to another different git repository.






                          share|improve this answer
























                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            You need to first install Git. Then to create a new repository, run within the folder that you've copied:



                            git init


                            Then you can add files you want to version control by git add (add -a for all files) and start committing the changes (git commit).



                            You don't have to push to any remote, as you can work on your local history (git log).



                            For more information, check:




                            • Git tutorial.


                            • git - the simple guide


                            Pushing/pulling without internet



                            Using git push command, it's possible to push over SSH (using local connection, intranet):



                            git remote add server ssh://[user@]host.xz[:port]/path/to/dev/repo.git/
                            git push server


                            or pushing into the folder:



                            git push /mnt/usb/my_repo


                            This assumes you've two copies of your repository.



                            The same with pulling, e.g.



                            git pull /mnt/usb/my_repo


                            Patching



                            To apply patches, you can use patch command or git apply.



                            See: Create patch or diff file from git repository and apply it to another different git repository.






                            share|improve this answer














                            You need to first install Git. Then to create a new repository, run within the folder that you've copied:



                            git init


                            Then you can add files you want to version control by git add (add -a for all files) and start committing the changes (git commit).



                            You don't have to push to any remote, as you can work on your local history (git log).



                            For more information, check:




                            • Git tutorial.


                            • git - the simple guide


                            Pushing/pulling without internet



                            Using git push command, it's possible to push over SSH (using local connection, intranet):



                            git remote add server ssh://[user@]host.xz[:port]/path/to/dev/repo.git/
                            git push server


                            or pushing into the folder:



                            git push /mnt/usb/my_repo


                            This assumes you've two copies of your repository.



                            The same with pulling, e.g.



                            git pull /mnt/usb/my_repo


                            Patching



                            To apply patches, you can use patch command or git apply.



                            See: Create patch or diff file from git repository and apply it to another different git repository.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 10 mins ago

























                            answered 32 mins ago









                            kenorb

                            10.1k1574106




                            10.1k1574106




















                                up vote
                                0
                                down vote













                                Git is actually really suitable for it, it does not require any internet access at all because all the required information is stored in the .git directory.






                                share|improve this answer




















                                • but repositories can grow big, is there a more lightweight way than replacing whole .git directory if I want to add commit or two once in a while? Can I "pull" from usb stick?
                                  – Tutu Kaeen
                                  56 mins ago










                                • I'm pretty sure you will find better answers to those questions if you do a bit of searching online, my git knowledge is quite rusty. I'm fairly certain that it's possible though.
                                  – JohnEye
                                  35 mins ago














                                up vote
                                0
                                down vote













                                Git is actually really suitable for it, it does not require any internet access at all because all the required information is stored in the .git directory.






                                share|improve this answer




















                                • but repositories can grow big, is there a more lightweight way than replacing whole .git directory if I want to add commit or two once in a while? Can I "pull" from usb stick?
                                  – Tutu Kaeen
                                  56 mins ago










                                • I'm pretty sure you will find better answers to those questions if you do a bit of searching online, my git knowledge is quite rusty. I'm fairly certain that it's possible though.
                                  – JohnEye
                                  35 mins ago












                                up vote
                                0
                                down vote










                                up vote
                                0
                                down vote









                                Git is actually really suitable for it, it does not require any internet access at all because all the required information is stored in the .git directory.






                                share|improve this answer












                                Git is actually really suitable for it, it does not require any internet access at all because all the required information is stored in the .git directory.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered 1 hour ago









                                JohnEye

                                92221021




                                92221021











                                • but repositories can grow big, is there a more lightweight way than replacing whole .git directory if I want to add commit or two once in a while? Can I "pull" from usb stick?
                                  – Tutu Kaeen
                                  56 mins ago










                                • I'm pretty sure you will find better answers to those questions if you do a bit of searching online, my git knowledge is quite rusty. I'm fairly certain that it's possible though.
                                  – JohnEye
                                  35 mins ago
















                                • but repositories can grow big, is there a more lightweight way than replacing whole .git directory if I want to add commit or two once in a while? Can I "pull" from usb stick?
                                  – Tutu Kaeen
                                  56 mins ago










                                • I'm pretty sure you will find better answers to those questions if you do a bit of searching online, my git knowledge is quite rusty. I'm fairly certain that it's possible though.
                                  – JohnEye
                                  35 mins ago















                                but repositories can grow big, is there a more lightweight way than replacing whole .git directory if I want to add commit or two once in a while? Can I "pull" from usb stick?
                                – Tutu Kaeen
                                56 mins ago




                                but repositories can grow big, is there a more lightweight way than replacing whole .git directory if I want to add commit or two once in a while? Can I "pull" from usb stick?
                                – Tutu Kaeen
                                56 mins ago












                                I'm pretty sure you will find better answers to those questions if you do a bit of searching online, my git knowledge is quite rusty. I'm fairly certain that it's possible though.
                                – JohnEye
                                35 mins ago




                                I'm pretty sure you will find better answers to those questions if you do a bit of searching online, my git knowledge is quite rusty. I'm fairly certain that it's possible though.
                                – JohnEye
                                35 mins ago










                                up vote
                                0
                                down vote













                                Method 1: You can create a 'bare repository' on the USB stick, then push to it and pull from it as you would with any other remote repository. In other words, repository operations via local paths aren't any different from operations via SSH or HTTPS URLs.




                                1. Create a 'remote' repository:



                                  $ git init --bare /mnt/Stick/Repositories/Large_Project.git



                                2. In computer 1, push everything to it:



                                  $ cd ~/Large_Project
                                  $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                                  $ git push usb master



                                3. In computer 2, well, same as always.



                                  $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                                  $ git pull usb


                                (You can push/fetch/pull from a URL or path directly, too.)




                                Method 2: You can create 'transfer bundles' which archive a given list of commits into a single file.



                                Unfortunately the bundle commands don't automatically remember what was already bundled the last time, so manual tagging or note-keeping is needed. I'll just take the examples from the git-bundle manual.




                                1. In computer 1, create a bundle of the entire branch:



                                  $ cd ~/Large_Project
                                  $ git bundle create /mnt/Stick/Project.bundle master
                                  $ git tag -f last-bundled master



                                2. In computer 2, pull from the bundle as if it were a repository:



                                  $ cd ~/Large_Project
                                  $ git pull /mnt/Stick/Project.bundle


                                Subsequent bundles don't need to pack the whole master – they can pack just the newly added commits from last-bundled..master instead.




                                1. In computer 1, create a bundle of the newly added commits:



                                  $ cd ~/Large_Project
                                  $ git bundle create /mnt/Stick/Project.bundle last-bundled..master
                                  $ git tag -f last-bundled master


                                2. Same as above.






                                share|improve this answer


























                                  up vote
                                  0
                                  down vote













                                  Method 1: You can create a 'bare repository' on the USB stick, then push to it and pull from it as you would with any other remote repository. In other words, repository operations via local paths aren't any different from operations via SSH or HTTPS URLs.




                                  1. Create a 'remote' repository:



                                    $ git init --bare /mnt/Stick/Repositories/Large_Project.git



                                  2. In computer 1, push everything to it:



                                    $ cd ~/Large_Project
                                    $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                                    $ git push usb master



                                  3. In computer 2, well, same as always.



                                    $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                                    $ git pull usb


                                  (You can push/fetch/pull from a URL or path directly, too.)




                                  Method 2: You can create 'transfer bundles' which archive a given list of commits into a single file.



                                  Unfortunately the bundle commands don't automatically remember what was already bundled the last time, so manual tagging or note-keeping is needed. I'll just take the examples from the git-bundle manual.




                                  1. In computer 1, create a bundle of the entire branch:



                                    $ cd ~/Large_Project
                                    $ git bundle create /mnt/Stick/Project.bundle master
                                    $ git tag -f last-bundled master



                                  2. In computer 2, pull from the bundle as if it were a repository:



                                    $ cd ~/Large_Project
                                    $ git pull /mnt/Stick/Project.bundle


                                  Subsequent bundles don't need to pack the whole master – they can pack just the newly added commits from last-bundled..master instead.




                                  1. In computer 1, create a bundle of the newly added commits:



                                    $ cd ~/Large_Project
                                    $ git bundle create /mnt/Stick/Project.bundle last-bundled..master
                                    $ git tag -f last-bundled master


                                  2. Same as above.






                                  share|improve this answer
























                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    Method 1: You can create a 'bare repository' on the USB stick, then push to it and pull from it as you would with any other remote repository. In other words, repository operations via local paths aren't any different from operations via SSH or HTTPS URLs.




                                    1. Create a 'remote' repository:



                                      $ git init --bare /mnt/Stick/Repositories/Large_Project.git



                                    2. In computer 1, push everything to it:



                                      $ cd ~/Large_Project
                                      $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                                      $ git push usb master



                                    3. In computer 2, well, same as always.



                                      $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                                      $ git pull usb


                                    (You can push/fetch/pull from a URL or path directly, too.)




                                    Method 2: You can create 'transfer bundles' which archive a given list of commits into a single file.



                                    Unfortunately the bundle commands don't automatically remember what was already bundled the last time, so manual tagging or note-keeping is needed. I'll just take the examples from the git-bundle manual.




                                    1. In computer 1, create a bundle of the entire branch:



                                      $ cd ~/Large_Project
                                      $ git bundle create /mnt/Stick/Project.bundle master
                                      $ git tag -f last-bundled master



                                    2. In computer 2, pull from the bundle as if it were a repository:



                                      $ cd ~/Large_Project
                                      $ git pull /mnt/Stick/Project.bundle


                                    Subsequent bundles don't need to pack the whole master – they can pack just the newly added commits from last-bundled..master instead.




                                    1. In computer 1, create a bundle of the newly added commits:



                                      $ cd ~/Large_Project
                                      $ git bundle create /mnt/Stick/Project.bundle last-bundled..master
                                      $ git tag -f last-bundled master


                                    2. Same as above.






                                    share|improve this answer














                                    Method 1: You can create a 'bare repository' on the USB stick, then push to it and pull from it as you would with any other remote repository. In other words, repository operations via local paths aren't any different from operations via SSH or HTTPS URLs.




                                    1. Create a 'remote' repository:



                                      $ git init --bare /mnt/Stick/Repositories/Large_Project.git



                                    2. In computer 1, push everything to it:



                                      $ cd ~/Large_Project
                                      $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                                      $ git push usb master



                                    3. In computer 2, well, same as always.



                                      $ git remote add usb /mnt/Stick/Repositories/Large_Project.git
                                      $ git pull usb


                                    (You can push/fetch/pull from a URL or path directly, too.)




                                    Method 2: You can create 'transfer bundles' which archive a given list of commits into a single file.



                                    Unfortunately the bundle commands don't automatically remember what was already bundled the last time, so manual tagging or note-keeping is needed. I'll just take the examples from the git-bundle manual.




                                    1. In computer 1, create a bundle of the entire branch:



                                      $ cd ~/Large_Project
                                      $ git bundle create /mnt/Stick/Project.bundle master
                                      $ git tag -f last-bundled master



                                    2. In computer 2, pull from the bundle as if it were a repository:



                                      $ cd ~/Large_Project
                                      $ git pull /mnt/Stick/Project.bundle


                                    Subsequent bundles don't need to pack the whole master – they can pack just the newly added commits from last-bundled..master instead.




                                    1. In computer 1, create a bundle of the newly added commits:



                                      $ cd ~/Large_Project
                                      $ git bundle create /mnt/Stick/Project.bundle last-bundled..master
                                      $ git tag -f last-bundled master


                                    2. Same as above.







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited 12 mins ago

























                                    answered 20 mins ago









                                    grawity

                                    221k33453517




                                    221k33453517




















                                        Tutu Kaeen is a new contributor. Be nice, and check out our Code of Conduct.









                                         

                                        draft saved


                                        draft discarded


















                                        Tutu Kaeen is a new contributor. Be nice, and check out our Code of Conduct.












                                        Tutu Kaeen is a new contributor. Be nice, and check out our Code of Conduct.











                                        Tutu Kaeen is a new contributor. Be nice, and check out our Code of Conduct.













                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1367571%2fusing-git-without-internet-access%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        What does second last employer means? [closed]

                                        List of Gilmore Girls characters

                                        Confectionery