在 GIT 中创建现有目录作为存储库
Create Existing Directory as Repository in GIT
我有一个目录说 cplusplus_learn 我的用户名是 apex_user (比如)在 git。 cplusplus_learn里面有一些我正在练习C++语言的文件和目录。我想创建一个与 cplusplus_learn 同名的存储库,并推送 GITHUB 网站中的所有内容。有人可以向我解释这样做的完整步骤吗?
我浏览了各种链接,但完全感到困惑。主要是说已经有repo了。
convert-existing-non-empty-directory-into-a-git-working-directory
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
以上是我试过的。我知道有问题,但我想不通。
- 将您的 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
首先您需要登录您的 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
希望这能奏效。谢谢:)
您可以使用 git hub cli https://cli.github.com/manual/gh_repo_create
我有一个目录说 cplusplus_learn 我的用户名是 apex_user (比如)在 git。 cplusplus_learn里面有一些我正在练习C++语言的文件和目录。我想创建一个与 cplusplus_learn 同名的存储库,并推送 GITHUB 网站中的所有内容。有人可以向我解释这样做的完整步骤吗? 我浏览了各种链接,但完全感到困惑。主要是说已经有repo了。
convert-existing-non-empty-directory-into-a-git-working-directory
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
以上是我试过的。我知道有问题,但我想不通。
- 将您的 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
首先您需要登录您的 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
希望这能奏效。谢谢:)
您可以使用 git hub cli https://cli.github.com/manual/gh_repo_create