如何从命令行创建 GitHub 存储库?

问题描述 投票:0回答:0

目前我正在学习 **JavaScript ** 并在本地练习,然后将我的作品上传到 GitHub 上。

现在我从 GitHub 网站(Repositories => New => Create repository)手动创建存储库,以生成 URL(例如:https://github.com/ < myUserName> / < repositoryName.git >,然后在命令行中,我使用正常步骤:

  1. git init
  2. git add .
  3. git commit -m "complete.."
  4. git remote add origin **https://github.com/<myAccount>/<*repositoryName*.git>**
    // 在这里再次使用它
  5. git push -u origin master

我想知道在命令行中创建(并生成存储库 url)的命令。

提前谢谢你,

附: 我还检查了其他主题 文字 第一次尝试:

$ gp repo create testRepo --public
bash: gp: command not found

第二次尝试:

$ curl -u 'myGitHubUserName' https://api.github.com/user/repos -d '{"name":"testRepo"}' // also tried myUserName without ''
Enter host password for user 'myGitHubUserName':
{

//即使输入随机或输入我的密码,输入后我得到这个:

 "message": "Requires authentication",
  "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user"   
}

第三次尝试: 我还尝试安装 GitHub cli

myuser~
$ scoop bucket add github-gh https://github.com/cli/scoop-gh.git
bash: scoop: command not found

myuser ~
$ scoop install gh
bash: scoop: command not found

第四次尝试:

Maria ~/Desktop/testGit
$ curl -u 'myUserName' https://api.github.com/user/repos -d '{"name":"testRepoN"}'
Enter host password for user 'myUserName':
{
  "message": "Requires authentication",
  "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user"
}

Maria ~/Desktop/testGit
$ git remote add origin [email protected]:myUserName/testRepoN.git
fatal: not a git repository (or any of the parent directories): .git

...提前感谢您的支持。

github repository
© www.soinside.com 2019 - 2024. All rights reserved.