英文:
Is it possible to initiate a remote repository on GitHub from the Git Bash command line?
问题
如果不可能,是否有其他方法可以在不进入浏览器并手动创建的情况下完成,然后同步到本地?
英文:
If it is not possible, is there any way to do it without entering the browser and manually creating one, which then has to be synced to the local one?
答案1
得分: -1
可以使用Github的CLI工具,gh,以及gh repo create命令来实现。您需要先安装这个工具。不需要使用curl
。
运行gh repo create
将以交互方式创建一个新的存储库。该命令具有允许克隆新存储库(--clone
)或从本地文件夹创建新存储库(--source
)甚至立即推送(--push
)的标志。
例如:
gh repo create my-project --private --source=. --push
gh auth login将使用浏览器登录并将令牌存储在本地,以便您不必每次进行身份验证。
英文:
It's possible if you use Github's CLI tool, gh, with gh repo create. You'll have to install the tool first. There's no need for curl
Running gh repo create
will create a new repository interactively. The command has flags that allow cloning the new repo (--clone
) or create the new repo from a local folder (--source
) and even push immediately (--push
).
For example:
gh repo create my-project --private --source=. --push
gh auth login will use the browser to login and store a token locally so you don't have to authenticate every time.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论