繁体   English   中英

在GIT中将现有目录创建为存储库

[英]Create Existing Directory as Repository in GIT

我有一个目录说cplusplus_learn ,我的用户名是apex_user (说)在git中 在cplusplus_learn中,有一些我正在练习C ++语言的文件和目录。 我想创建一个与cplusplus_learn同名的存储库,并在GITHUB网站上推送所有东西。 有人可以向我解释完成这一步骤的完整步骤。 我经历了各种各样的链接但完全糊涂了。 大多说已经有回购。

转换存在,非空目录到-A-混帐工作目录

GitHub的错误-库未找到致命

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

$ 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

以上就是我试过的。 我知道有什么不对,但我无法弄明白。

首先,您需要登录您的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

希望这应该工作。 谢谢 :)

  • 将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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM