6

我有一个目录说cplusplus_learn,我的用户名是git中的apex_user(比如说)。在 cplusplus_learn 里面,有一些我正在练习 C++ 语言的文件和目录。我想创建一个与 cplusplus_learn 同名的存储库,并将所有内容推送到 GITHUB网站。有人可以向我解释这样做的完整步骤。我浏览了各种链接,但完全困惑。主要是说已经进行了回购。

将现有的非空目录转换为 git 工作目录

github-error-repository-not-found-fatal

注意:我想从终端做的所有事情。

$ cd cplusplus_learn
$ git init .
$ git commit -m 'My first commit'
$ git remote add origin https://github.com/apex-user.git
fatal: remote origin already exists.
$ git push -u origin master
fatal: repository 'https://github.com/apex-user/' not found

上面给出的是我尝试过的。我知道有什么问题,但我无法弄清楚。

4

3 回答 3

9

首先,您需要登录到您的 github 帐户并创建一个名为 cplusplus_learn 的存储库

我想从终端做的所有事情。正如你已经描述的那样。根据您的描述,您似乎已经设置了错误的远程 URL,因此您需要更新或重置它,如下所示

$ cd cplusplus_learn
$ git init 
$ git commit -m 'My first commit'
$ git remote set-url origin https://github.com/apex-user/cplusplus_learn.git
$ git push -u origin master

希望这应该有效。谢谢 :)

于 2016-06-04T07:29:54.743 回答
2
  • 将您的 SSH 密钥添加到 Github 配置文件设置中。
  • 在 Github 上创建一个存储库。例如 (RepoName)
  • 导航到您的项目目录cplusplus_learn
  • 初始化 git git init
  • git remote add origin https://github.com/apex-user/RepoName.git
  • git add -A
  • git commit -m "Message you would like to put"
  • git push origin master
于 2016-06-04T07:13:01.730 回答
0

您可以使用 git hub cli https://cli.github.com/manual/gh_repo_create

于 2021-07-31T21:36:22.660 回答