First, you need to setup the remote git repository.

  1. ssh
  2. Navigate to the parent directory you are using, e.g. ” cd repositories “.
  3. Create a directory for your new repository by typing ” mkdir my_project.git “.
  4. Navigate to the directory by typing ” cd my_project.git “.
  5. Initiate a bare git repository by typing ” git init —bare “.
  6. Type ” exit ” to log out of the remote server

Next, on your machine, you need to push the initial contents.

  1. Create a folder. Navigate to it and copy over your initial files.
  2. Type ” git init “. This will create a git repository in your folder. You should see a ” .git ” folder if you type ” ls -la “.
  3. Type ” git add . “. This will add/stage all the new files to your git repository.
  4. Type ” git commit -m ‘initial project version’ “. This will commit your files to the repository. The ” -m ” option will allow you to save a message along with the commit. This is a good habit to repeat for your commits. It will be hard to remember why you did something later.
  5. Type ” git remote add origin me@remote_server:my_project.git “.
  6. Type ” git push origin master “. You should have to enter your password for the remote server.

You now have a working remote repository.

  1. In order to clone (get a copy), type ” git clone ssh:// NewProjectName “. This has the optional directory at the end. This will name the new directory ” NewProjectName ” instead of the default ” my_project “.
  2. Navigate to the new directory by typing ” cd NewProjectName “.