Skip to content

git-clone

The Git clone resource reference. This resource will allow Codify to clone repos from any git remote (Github, Bitbucket, GitLab, etc…)

Parameters:

  • repository: (string) The repository url. This can be any url supported by git clone (ssh, https, ftp).

  • remote: (string) The remote url. This can be any url supported by git clone (ssh, https, ftp).` (removed in version 0.7.0 use repository instead)

  • directory: (string) The directory to git clone into. Note that a nested folder will not be created and files from the root level of the git repository will be copied into the directory. Use the parentDirectory parameter instead to specify the parent directory to clone into. Equivalent to using the <directory> option of git clone. Both relative and absolute paths work.

  • parentDirectory: (string) The parent directory to clone into. This option will call git clone within the parent directory and create a folder name using the last part of the git url (ex: repo for /path/to/repo.git).

Example usage:

codify.json
[
{
"type": "git-clone",
"parentDirectory": "~/projects",
"remote": "[email protected]:kevinwang5658/codify-plugin-lib.git"
},
// Multiple git-clones can be specified
{
"type": "git-clone",
"directory": "~/projects/npm", // Directory will allow objects to be directly cloned into a directory
"repository": "https://github.com/npm/npm.git"
}
]

Setting up Github ssh and clone a repo

Starter instructions for setting up Github SSH and cloning a repo.

  1. Generate a ssh key and start the ssh-agent.
terminal
ssh-keygen -t ed25519 -C "[email protected]"
eval "$(ssh-agent -s)"
  1. Create a ssh config if it doesn’t exist
terminal
touch ~/.ssh/config
  1. Open the ~/.ssh/config file with your favourite text editor and add the following. If a custom identity file name was used. Substitute ~/.ssh/id_ed25519 with your custom name.
Host github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
  1. Add ssh key to your keychain
terminal
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
  1. Copy the ssh public key to your clipboard.
terminal
pbcopy < ~/.ssh/id_ed25519.pub
  1. Login to your github account online and paste the public key under Settings > SSH and GPG keys > New SSH Key. More detailed instructions can be found on github

  2. For every repo you want to clone get the SSH url under the Code drop down on the home page of a repository

A image describing where to find the github clone dropdown
  1. Copy the url into your codify.json file and use codify apply to clone the repo.
codify.json
[
{
"type": "git-clone",
"parentDirectory": "~/projects",
"remote": "[email protected]:kevinwang5658/codify-plugin-lib.git"
}
]