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
- On external harddrive create a folder.
Type: mkdir myrepo.git
On macOS this folder is located at:
/Volumes/Backup/myrepo.git
- Create a bare repo on the external harddrive.
Type: cd myrepo.git
Type: git init --bare
- On your laptop create a folder.
Type: mkdir ~/myrepo
- Make myrepo a local git repository on your laptop.
Type: cd ~/myrepo
Type: git init
- Create file ~/myrepo/.gitignore
- Hook the local repository to the remote repository.
Type: git remote add origin /Volumes/Backup/myrepo.git
- Add your local repository to your favorite Git desktop client.
For example: SourceTree
- Open SourceTree, select myrepo and select Settings.
- Select tab Remotes.
Select the Remote repository path:
origin /Volumes/Backup/myrepo.git
- Select Edit button
Select Host Type: Unknown and press OK button.
- In ~/myrepo, create folders, subfolders and files.
Commit files to your local git repository.
- Push to the remote repository running on the external hard drive.
- To use the git repsoitory on another computer, attach the external harddrive to the computer.
- Go to the location where the git repository must be created, for example:
Type: cd ~repositories
- Get the git repository.
Type: git clone /Volumes/Backup/myrepo.git
|