-
-
Save robwierzbowski/5430952 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# https://gist.github.com/robwierzbowski/5430952/ | |
# Create and push to a new github repo from the command line. | |
# Grabs sensible defaults from the containing folder and `.gitconfig`. | |
# Refinements welcome. | |
# Gather constant vars | |
CURRENTDIR=${PWD##*/} | |
GITHUBUSER=$(git config github.user) | |
# Get user input | |
read "REPONAME?New repo name (enter for ${PWD##*/}):" | |
read "USER?Git Username (enter for ${GITHUBUSER}):" | |
read "DESCRIPTION?Repo Description:" | |
echo "Here we go..." | |
# Curl some json to the github API oh damn we so fancy | |
curl -u ${USER:-${GITHUBUSER}} https://api.github.com/user/repos -d "{\"name\": \"${REPONAME:-${CURRENTDIR}}\", \"description\": \"${DESCRIPTION}\", \"private\": false, \"has_issues\": true, \"has_downloads\": true, \"has_wiki\": false}" | |
# Set the freshly created repo to the origin and push | |
# You'll need to have added your public key to your github account | |
git remote set-url origin [email protected]:${USER:-${GITHUBUSER}}/${REPONAME:-${CURRENTDIR}}.git | |
git push --set-upstream origin master |
I'm using
#Usage: gcreate userName repoName "Description if any"
gcreate () {
curl -u $1 https://api.github.com/user/repos -d "{\"name\": \"$2\", \"description\": \"$3\"}"
}
You can put it in .bash_profile
/ .bashrc
and simply use gcreate
hi guys
I am using curl to create remote repository in GITHUB but it is getting error. Can anyone help me out which path i need to pass during curl command execution like GITHUB Url or github organization Url . Please it is urgent
when I am using curl below error i am getting
<title>405 Not Allowed</title>405 Not Allowed
@bogas04 That's exactly what have trying to do the past 15 minutes, tks!
Did not work for me, I created a bash function with name gcreate
using above contents, it gives following error:
$ gcreate
# now nothing appears, it does not ask for repo name, if I type repo name "hello" and press enter, it gives this error:
-bash: read: `REPONAME?New repo name (enter for github):': not a valid identifier
@bogas04, the function is simple and appealing, but, however, unfortunately, did not work.
$ gcreate bpJedisim repoName "Description if any"
Enter host password for user 'bpJedisim':
curl: (35) error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Is there a way to do that from sbt rather than shell ?
I get this error
curl: (35) error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Pls help
It's not asking any username or repo name it is giving the following error
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
pls help.
Sorry, I no longer maintain this code. There are probably better examples on the internet in 2019.
I'm using
#Usage: gcreate userName repoName "Description if any" gcreate () { curl -u $1 https://api.github.com/user/repos -d "{\"name\": \"$2\", \"description\": \"$3\"}" }You can put it in
.bash_profile
/.bashrc
and simply usegcreate
Thanks, its amazing just what I was looking for.
Hello Team,
we have one task where we need to upload code with mulptiple branches into gitlab account. total project: 140 (approx) branches in each project :4-5 (average)
I have written one script to download all repository with branches from gitlab account.
Now we have to upload it in another gitlab account.
If anyone is intereseted in this u can write the script.
script should take code from local system with branches and upload it in gitlab one by one. we can refer to gitlab API.
defunkts' hub is 100000* better than this. Go there!