我正在尝试将一个新的本地“repo”推送到我的 GitHub 帐户,但该帐户不存在,命令如下:
git push https://github.com/username/gitinit
出现错误:
remote: Repository not found.
fatal: repository 'https://github.com/username/gitinit/' not found
我的问题是:
我们可以使用命令提示符 Ubuntu 创建一个存储库(GitHub 帐户中不存在)吗?
如果可以的话怎么办?
最佳答案
您需要使用GitHub API for Repository以便从您的 Ubuntu shell session 创建一个新的存储库。
POST /user/repos
即 ( from this tutorial ):
curl -u 'YOUR-USER-NAME' https://api.github.com/user/repos -d '{"name": "PUT-YOUR-REPO-NAME-HERE"}'
您可以添加不同的选项:
{
"name": "Hello-World",
"description": "This is your first repository",
"homepage": "https://github.com",
"private": false,
"has_issues": true,
"has_wiki": true,
"has_downloads": true
}
然后:
git remote add origin https://github.com/username/gitinit.git
git push -u origin master
您可以在“Is it possible to create a remote repo on GitHub from the CLI without opening browser?”中找到更多信息/替代方案。
关于git - 如何从 ubuntu 终端在 github 帐户中推送新的本地存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37609043/