A CLI tool for seamlessly uploading local projects to Github and cloning/forking existing Github projects.
npm install -g atlas-github-init
I like making npm packages, and a lot of the initialization tasks are the same for each new package:
- Finish a new npm package locally.
- Create a blank Github repository.
- Set the origin remote.
- Push my new package to the new Github repository.
- Optionally, I'll want to fork and clone a Github repository to my local machine.
Initially, I wanted to include the option to set pre-defined git hooks, but I decided later that this would be outside the scope of this package. I also wanted to try and create my own semantics for pushing and merging to promote a feature-branch-based workflow, but decided not to. The existing
git subcommands are already fairly concise and expressive and didn't really need to be repackaged at the expense of freedom.
Print usage information:
Clear your cached login token and metadata:
If you are in a repository, you can initialize and upload it to your Github with:
You can clone a repository from Github by specifying an owner and repo:
atlas repo atlassubbed atlas-npm-init --ext
The name of your repo is derived from your folder name. The
--ext (external) flag indicates that you want to fork the repo to your own Github, in addition to cloning it to your local machine. The remotes will be set correctly. In this example, the repo would be created at:
./atlassubbed/atlas-npm-init. Note that none of these folders need to exist beforehand; they will be created on-the-fly if they don't exist.
By default, the CLI tool will automatically enable certain
master branch restrictions and pull-request checks on your newly created (either new or forked) repository. You can disable this with a flag:
atlas repo --unsafe
Note that cloning a repo you already own (e.g. no
--ext flag) will not attempt to change these security restrictions, so the
--unsafe flag is not necessary:
atlas repo atlassubbed atlas-github-init
--debug flag on any subcommand will print more information on failures or errors:
atlas repo octocat Spoon-Knife --ext --debug
If you're using
atlas-npm-init to initialize your project, you will have travis-ci placeholder badge at the top of your
README.md file. This will automatically be filled in when you initialize your new Github repository with
atlas repo. If the placeholder isn't present, then no travis-related content will be added to your
password for git
When pushing to Github, you can use a personal access token as your password when
git prompts you. I haven't yet found a good way to supply a password to git running in a subshell via stdin. A different way to do this is by embedding the token in the remote URL like this:
Overall, this seems like a pretty bad idea! I'm sure it can be done a different way, maybe with a private key or by writing to stdin on-the-fly?
I'd like to have a global executable called
atlas which has the following sub-commands:
npm: generates a minimal npm starter app.
webpack: generates a minimal webpack starter app.
repo: automatically sync your project to github or fork/clone existing projects.
: Not needed, thanks to
As of right now, the
atlas command only has subcommands 3 and 4 above.
altas-webpack-init are their own commands, but I'd like to turn them into 1 and 2 above, respectively. The
atlas command should then be responsible for initializing pretty much everything in a new project.
While the CLI tool will cache your login token for Github so you don't need to enter your credentials more than once, you will have to enter your password again when
git is running for certain tasks. Git has its own way of caching your creds, so you will only have to "enter your password twice" once. Please configure Git on your local machine to enable caching if you don't wanna keep entering your creds for Git.