Automatically fork, clone, and setup an upstream remote for a GitHub repository. By default, the master branch will track the upstream remote.
Intended as a "quick-start" for contributing to a GitHub repository. More services such as GitLab and BitBucket are coming soon™. The code is ready for multiple services, but the APIs for them haven't been implemented.
This project is licensed under the terms of the MIT license. See LICENSE.txt
for more details
This project requires a libgit2
, and cmake
for building.
Currently, all methods of installation require building from source, and a working Rust installation. To quickly setup Rust (and Cargo), use rustup.
cargo install ghcl
sh
git clone https://github.com/PlasmaPower/ghcl.git
cd ghcl
cargo build --release
sudo cp target/release/ghcl /usr/bin # or just cargo install, to install for just your user
```
ghcl 0.1.0
Lee Bousfield
USAGE:
ghcl [FLAGS] [OPTIONS]
FLAGS: -h, --help Prints help information --no-quiet Don't be quiet (output status messages) --no-track-upstream Don't setup master to track upstream --no-upstream Don't setup an upstream remote (implies notrackupstream) -q, --quiet Don't output status messages --setup-upstream Setup an upstream remote (default) --track-upstream Setup master to track upstream (default, imples setup-upstream) -V, --version Prints version information
OPTIONS:
-c, --config
ARGS:
The config is located in:
~/.config/ghcl/config.yml
(or $XDG_CONFIG_HOME/ghcl/config.yml
)~/Library/Application Support/ghcl/config.yml
%APPDATA%\PlasmaPower\ghcl
Contents (all of which are optional, and can be overriden by arguments):
| Key | Type/valid values | Description | |-------------------|---------------------|------------------------------------------------------------------------------------------------| | organization | String | the organization to clone repositories to | | trackupstream | bool | should the master branch be setup to track upstream? (if true, setupupstream cannot be false) | | setupupstream | bool | should the upstream remote be created? | | remotename | String | the name of the upstream remote to create (only used if setupupstream is true) | | originprotocol | HTTPS or SSH | the protocol to use for the origin remote | | upstreamprotocol | HTTPS or SSH | the protocol to use for the upstream remote (only used if setupupstream is true) | | defaultservice | only github for now | the service to use if the repository is in the form of "user/repository" | | quiet | bool | should status messages be outputed? | | forktimeout | integer | the maximum total timeout for attempting to clone after a fork | | authentication | map - see below | authentication (usually username + password) for each service |
Authentication is a map of service (currently only "github") to a username and password. With GitHub, you can (and it's recommended to) use a personal access token with the "repo" permission instead of an actual password. That way, it has limited permissions, and can be easily revoked.
Example config:
yaml
organization: myOrg
track_upstream: false
setup_upstream: true
remote_name: my-upstream
origin_protocol: SSH
upstream_protocol: HTTPS
default_service: github
quiet: true
fork_timeout: 30
authentication:
github:
username: ExampleUser
password: efbfd4e43d8e77c1dc24... # personal access token
That probably means your SSH agent is misconfigured.
I'm not sure why it causes a freeze, but to fix it, run ssh-add ~/.ssh/id_rsa
, or whatever your GitHub SSH key is.
You should also put that in your .profile
, or wherever you start ssh-agent
.
This program is opinionated, and not intended to fit every workflow. However, if it's just a small option that's missing, feel free to create an issue or pull request.