sarpay
8/7/2018 - 2:14 PM

Clone a remote to existing local

Clone a remote repo to an existing local repo

Open Git CMD / Bash

  1. First get to the existing directory
> cd my/folder/

or Hold SHIFT, right click the folder you're in, then select Open command window here.

  1. Now start a new git repository
> git init
  1. Identify if the current elements on the directory are needed or not and add them to the .gitignore file.

    1. Create the text file gitignore.txt
    2. Open it in a text editor and add your rules, then save and close
    3. Hold SHIFT, right click the folder you're in, then select Open command window here
    4. Then rename the file in the command line, with ren gitignore.txt .gitignore
  2. When ready create the first commit on the server

> git add .
> git commit -m "my first commit"
  1. Now add the remote from where you want to clone
> git remote add origin https://github.com/sarpay/RoboAir.git
  1. Now just pull and merge with local git
> git pull origin master
  1. If you have some merge conflicts resolve them and commit your changes.