Create new repo on Bitbucket from Git Bash terminal?

前端 未结 7 1448
别那么骄傲
别那么骄傲 2020-12-22 19:56

Is it possible to create a new repository in Bitbucket by using command line Git? I have tried the following:

git clone --bare https://username@bitbucket.org         


        
相关标签:
7条回答
  • 2020-12-22 20:42

    Here is @hannesr's script tweaked a bit to accept input from prompts:

    # startbitbucket - creates remote bitbucket repo and adds it as git remote to cwd
    function startbitbucket {
        echo 'Username?'
        read username
        echo 'Password?'
        read -s password  # -s flag hides password text
        echo 'Repo name?'
        read reponame
    
        curl --user $username:$password \
             https://api.bitbucket.org/1.0/repositories/ \
             --data name=$reponame \
             --data is_private='true'
        git remote add origin git@bitbucket.org:$username/$reponame.git
        git push -u origin --all
        git push -u origin --tags
    }
    

    You should place this in your .bashrc or .bash_aliases.

    0 讨论(0)
提交回复
热议问题