https://github.com/krisnova/klone
Taking you from a git repository to development in seconds
https://github.com/krisnova/klone
Last synced: 4 months ago
JSON representation
Taking you from a git repository to development in seconds
- Host: GitHub
- URL: https://github.com/krisnova/klone
- Owner: krisnova
- License: apache-2.0
- Created: 2017-05-06T06:34:30.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-04T07:36:27.000Z (about 9 years ago)
- Last Synced: 2025-04-14T06:08:13.334Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 11 MB
- Stars: 42
- Watchers: 3
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
[](https://goreportcard.com/report/github.com/kris-nova/klone)
`klone` is a command line tool that makes it easy to start working with a git repository.
`klone` can can check out an arbitrary github repository and run it in any Docker container you like.
# Installing
```bash
go get -u github.com/kris-nova/klone
```
## Using `klone`
### In a Docker container
A user can easily go from an arbitrary github repository, to a docker container of their choice.
```bash
klone docker -c golang:1.8.3
```
Will use `docker` to checkout the `github.com/docker/docker` repository on a `golang:1.8.3` Docker image.
`klone` will run itself inside the container and use the exact same logic it would use if running locally (which is described below).
A full walkthrough of using `klone` with [golang/dep](https://github.com/golang/dep) can be found [here](doc/dep-example.md).
### Local
```bash
klone kubernetes
```
`klone` has built in logic to form possible repository information from a simple string.
For example `klone kubernetes` will attempt `github.com/kubernetes/kubernetes` and find the repository.
`klone` will also detect the programming language the repository is written in, and check the code out accordingly.
After a `klone` you should have the following `git remote -v` configuration
| Remote | URL |
| ------------- | ------------------------------------------- |
| origin | git@github.com:`$you`/`$repo` |
| upstream | git@github.com:`$them`/`$repo` |
# GitHub Credentials
Klone will prompt you the first time you use the program for needed credentials.
On a first run klone will cache local configuration to `~/.klone/auth` after it creates a token via the API.
Klone will *never* store your passwords in plaintext.
# Testing
Export `TEST_KLONE_GITHUBUSER` and `TEST_KLONE_GITHUBPASS` with a GitHub user/pass for a test account.
I use handy dandy @knovabot for my testing.
Run the test suite
```
make test
```
# Environmental variables
| Variable | Behaviour |
| ------------------------------------- | ------------------------------------------------------ |
|KLONE_WORKSPACE | If set, klone will klone here for simple klones only |
|KLONE_GITHUBTOKEN | GitHub acccess token to use with GitHub.com |
|KLONE_GITHUBUSER | GitHub user name to authenticate with |
|KLONE_GITHUBPASS | GitHub password to authenticate with |
|TEST_KLONE_GITHUBTOKEN | (Testing) GitHub acccess token to use with GitHub.com |
|TEST_KLONE_GITHUBUSER | (Testing) GitHub user name to authenticate with |
|TEST_KLONE_GITHUBPASS | (Testing) GitHub password to authenticate with |
# Passing environmental variables to containers
By default klone will automatically pass ALL environmental variables that begin with the prefix "KLONE_CONTAINER_" and will pass the variable WITHOUT the prefix.
For example setting `KLONE_CONTAINER_GOPATH=/my/gopath` will pass `GOPATH=/my/gopath` to the container.
Environmental variables cannot be passed in as command line flags.