Github的代碼倉庫分爲2種類型:git
下面就使用Shell腳本建立這2種類型的代碼倉庫,腳本以下github
#!/bin/bash USER_NAME="[your username]" PROJECT_NAME="[project name]" PROJECT_DESCRIPTION="[project description]" git init git add . git commit -m 'first commit' curl -u $USER_NAME https://api.github.com/user/repos -d "{\"name\":\"$PROJECT_NAME\", \"description\": \"$PROJECT_DESCRIPTION\"}" git remote add origin git@github.com:$USER_NAME/"$PROJECT_NAME".git git push -u origin master
#!/bin/bash USER_NAME="[your username]" ORGS_NAME="[orgination name]" PROJECT_NAME="[project name]" PROJECT_DESCRIPTION="[project description]" git init git add . git commit -m 'first commit' curl -u $USER_NAME https://api.github.com/orgs/"$ORGS_NAME"/repos -d "{\"name\":\"$PROJECT_NAME\", \"description\": \"$PROJECT_DESCRIPTION\"}" git remote add origin git@github.com:$ORGS_NAME/"$PROJECT_NAME".git git push -u origin master