是否可以使用命令行Git在Bitbucket中创建新的存储库?我尝试过以下方法:
git clone --bare https://username@bitbucket.org/username/new_project.git
Run Code Online (Sandbox Code Playgroud)
我收到这条消息:
克隆到裸存储库'new_project.git'...
致命:https://username@bitbucket.org/username/new_project.git/info/refs
找不到:你在服务器上运行git update-server-info了吗?
如果不去网络应用程序就可以做到这一点.
Mar*_*rek 89
您可以使用Bitbucket REST API和cURL.例如:
curl --user login:pass https://api.bitbucket.org/1.0/repositories/ \
--data name=REPO_NAME
Run Code Online (Sandbox Code Playgroud)
创建名为的新存储库REPO_NAME
.
有关更多信息,请参阅使用Bitbucket REST API.
UPDATE
具体来说,对于Bitbucket V2,请参见POST一个新的回购
Ste*_*hen 49
最近,我们可以使用bitbucket-cli
.
使用安装它 pip
pip install bitbucket-cli
Run Code Online (Sandbox Code Playgroud)
然后使用创建一个repo
bitbucket create --private --protocol ssh --scm git YOUR_REPO_NAME
Run Code Online (Sandbox Code Playgroud)
请注意,这会创建一个私有git仓库,您可以使用它--public
进行公共访问,--scm hg
如果您使用Mercurial.用户名参数可以通过添加--username YOUR_USER_NAME
.
pzt*_*ick 11
这是@ hannesr的脚本调整了一点来接受来自提示的输入:
# 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
}
Run Code Online (Sandbox Code Playgroud)
你应该把它放在你的.bashrc
或.bash_aliases
.
小智 10
https://confluence.atlassian.com/bitbucket/repository-resource-423626331.html
$ curl -X POST -v -u username:password -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/teamsinspace/new-repository4 \
-d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }'
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
43057 次 |
最近记录: |