Git

 
 
Git is a distributed revision control system designed and developed by Linus Torvalds. Every Git clone is a full fledged repository with a complete history and full revision tracking capabilities, not dependant on network access or a central repository server.

More information can be found at: http://git-scm.com







Create a remote git repository on external harddrive



Information
Setup a git repository on an external hardrive and use this repository as the remote repository. On your laptop you can setup a local repository and push the changes to the remote repository.

Operating system used
macOS

Software prerequisites
none

Procedure
  1. On external harddrive create a folder.
    Type: mkdir myrepo.git

    On macOS this folder is located at:
    /Volumes/Backup/myrepo.git

  2. Create a bare repo on the external harddrive.
    Type: cd myrepo.git
    Type: git init --bare

  3. On your laptop create a folder.
    Type: mkdir ~/myrepo

  4. Make myrepo a local git repository on your laptop.
    Type: cd ~/myrepo
    Type: git init

  5. Create file ~/myrepo/.gitignore

  6. Hook the local repository to the remote repository.
    Type: git remote add origin /Volumes/Backup/myrepo.git

  7. Add your local repository to your favorite Git desktop client.
    For example: SourceTree

    Add local repo to Git desktop client

  8. Open SourceTree, select myrepo and select Settings.

    SourceTree settings

  9. Select tab Remotes.
    Select the Remote repository path: origin /Volumes/Backup/myrepo.git

    SourceTree settings

  10. Select Edit button
    Select Host Type: Unknown and press OK button.

    SourceTree host type

  11. In ~/myrepo, create folders, subfolders and files.
    Commit files to your local git repository.

  12. Push to the remote repository running on the external hard drive.

  13. To use the git repsoitory on another computer, attach the external harddrive to the computer.

  14. Go to the location where the git repository must be created, for example:
    Type: cd ~repositories

  15. Get the git repository.
    Type: git clone /Volumes/Backup/myrepo.git