There is an official github gem which, I think, does this. I'll try to add more information as I learn, but I'm only just now discovering this gem, so I don't know much yet.
UPDATE: After setting my API key, I am able to create a new repo on github via the create
command, however I am not able to use the create-from-local
command, which is supposed to take the current local repo and make a corresponding remote out on github.
$ gh create-from-local
=> error creating repository
If anyone has some insight on this, I'd love to know what I'm doing wrong. There's already an issue filed.
UPDATE: I did eventually get this to work. I'm not exactly sure how to re-produce the issue, but I just started from scratch (deleted the .git folder)
git init
git add .emacs
git commit -a -m "adding emacs"
Now this line will create the remote repo and even push to it, but unfortunately I don't think I can specify the name of the repo I'd like. I wanted it to be called "dotfiles" out on github, but the gh gem just used the name of the current folder, which was "jason" since I was in my home folder. (I added a ticket asking for the desired behavior)
gh create-from-local
This command, on the other hand, does accept an argument to specify the name of the remote repo, but it's intended for starting a new project from scratch, i.e. after you call this command, you get a new remote repo that's tracking a local repo in a newly-created subfolder relative to your current position, both with the name specified as the argument.
gh create dotfiles
~/.bash_history
. I would suggest replace-u 'USER:PASS'
with-u 'USER'
, then curl will ask you for password interactively. – Addi