Wednesday, 15 February 2012

git - Why does GitHub not let us create our repositories using the command line out-of-the-box? -



git - Why does GitHub not let us create our repositories using the command line out-of-the-box? -

wouldn't nice if github built git shell?

apparently stack overflow says have utilize curl it.

curl -u 'user' https://api.github.com/user/repos -d '{"name":"repo"}' # remember replace user username , repo repository/application name! git remote add together origin git@github.com:user/repo.git git force origin master

but doesn't work me. 401 unauthorized if utilize method:

note: --cacert include cert ssl in root directory

hrm. okay. found out official docs authorization token:

$ curl -i -h 'authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \ -d '{ \ "name": "blog", \ "auto_init": true, \ "private": true, \ "gitignore_template": "nanoc" \ }' \ https://api.github.com/user/repos

note: "name" required in -d json http body according developer.github.com/v3. can leave out else , type:

$ curl -i -h 'authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \ -d '{ \ "name": "new_repo_name", \ }' \ https://api.github.com/user/repos

problem is... typing in long token (you can't ctrl-v in cmd) going defeat purpose of using cli in first place.

edit

i found hub solution. install it, navigate github repo folder, , create repo this:

hub create new_repo_name

and we're done , ready commits , pushes. no complaints far.

regarding first question: not “restriction” github, git. git not designed github , has no back upwards pushing non-existent repositories. think github hack in on server side, create repo every typo etc, ikke pointed out.

if want nicer command-line support, can utilize github’s hub tool: https://github.com/github/hub. using that, can create repo hub create.

alternatively create little shell script contains required code , takes repository name parameter.

git curl github

No comments:

Post a Comment