Creating a Remote Git Repository

Using a remote repository is a great way to collaborate with others on projects. The repository can also be used as a way to create backups of your projects. Learn how to create a remote repository with Git.

I started using Git a week or two ago and thought it would be a good idea to create a remote repository on my Google Drive folder. The Google Drive folder automatically syncs the repository and other documents in the folder to my Google Drive account. Google Drive is a convenient way to back up my projects and access them from any device I have at home. Follow the steps below to create a remote repository.

Remote Repository

We will start by navigating to your remote directory. Once you are there follow the commands below to create the repository.

cd /remote/path/
mkdir project.git
cd project.git
git init --bare

Local Repository

The next step is to navigate back to where you would like your local repository to be. Once in the project folder run the commands below.

cd /path/project
git init
git add .
git commit -m 'My initial commit'
git remote add gDrive file://~/Google%20Drive/project.git
git push gDrive master

Congrats! You have now set up your repository. Let me know if you have any questions by leaving a comment below.