可以使用Git Bash命令行从GitHub上初始化一个远程存储库吗?

huangapple go评论50阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年3月3日 20:53:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75627331.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定