banner



How To Create Git Repository On Server

Before running the Git command to create the repository, we need to make sure that we're in the right directory. The process for doing this differs slightly between operating systems.

  • Instructions for Windows
  • Instructions for Mac
  • Instructions for Linux

If you need help getting set up, here's a handy guide to install and configure Git.

Windows

Open the Command Prompt from Start > Windows System, or by pressing Windows + R then typing cmd and clicking OK.

Windows Command Prompt

If you have created a folder for your project called shop in a Projects folder in your home directory, you'll need to run the following command:

Alternatively, you can click and drag the folder into the Command Prompt window which will automatically enter the path to the directory.

Now you're ready to actually create the repository.

Mac

Open the Terminal app which can be found in Applications > Utilities.

Mac Terminal

If you have created a folder for your project called shop in a Projects folder in your home directory, you'll need to run the following command:

Alternatively, you can click and drag the folder into the Terminal window which will automatically enter the path to the directory.

Now you're ready to actually create the repository.

Linux

Open the Terminal application from the start menu, or by pressing Ctrl + Alt + T.

Linux Terminal

If you have created a folder for your project called shop in a Projects folder in your home directory, you'll need to run the following command:

Now you're ready to actually create the repository.

Actually creating the repository

Now that you're in the right directory, enter git init in your command line and press enter to create a new empty Git repository. If successful, you should see a message like this:

            Initialized empty Git repository in /Users/rob/Projects/shop/.git/                      

A hidden folder named .git will have just been created inside your project's working directory. This folder contains all the information Git stores about your repository including historical changes, remote repository addresses, and more.

This .git folder is your local copy of the repository. Deleting the .git folder won't delete any of the files in your project, however you'll lose access to all of the historical changes tracked by Git.

In a future tutorial, you'll learn how to upload your Git repository to a remote server to preserve any local changes, share them, and give everyone else working on the project the ability to download their own local copy of the repository.

Don't worry if some of this doesn't make a lot of sense right now. All you need to know is that the .git folder is created by running git init and it is your own version of the project's repository.

How To Create Git Repository On Server

Source: https://www.deployhq.com/git/creating-a-repository

Posted by: jonesuner1965.blogspot.com

0 Response to "How To Create Git Repository On Server"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel