If you already have code in a remote repository (for example, on GitHub), all you need to do is "clone" it—make a local copy. Find the repository URL, either over HTTPS (for example, https://github.com/vim/vim.git) or SSH (for example, firstname.lastname@example.org:vim/vim.git). Execute the following command (replacing <url> with the repository URL):
$ git clone <url>
This should download the repository to a directory with the project name on your machine.
Your local and remote repositories will now operate independently. If you want to update your local repository with changes from the remote repository (the one you cloned), you'll have to run git pull --rebase.