简体   繁体   English

GitHub - 开始创建回购

[英]GitHub - getting started creating a repo

I followed these instructions from GitHub web page to create a first repo;我按照 GitHub web 页面中的这些说明创建了第一个 repo;

Global setup:
Set up git
  git config --global user.name "Your Name"
  git config --global user.email my_mail@gmail.com

Next steps:
  mkdir OpenSourceContrib  
  cd OpenSourceContrib  
  git init
  touch README
  git add README
  git commit -m 'first commit'
  git remote add origin git@github.com:dlib/OpenSourceContrib.git
  git push -u origin master

Existing Git Repo?现有 Git 回购? cd existing_git_repo git remote add origin git@github.com:dlib/OpenSourceContrib.git git push -u origin master cd existing_git_repo git remote add origin git@github.com:dlib/OpenSourceContrib.git git push -u origin master

Everything goes ok until cd existing_git_repo;一切正常,直到 cd existing_git_repo; then, I tried several path in the following command 'git remote add origin...' (notably, I first tried with the path where README file is located, beginning c:/Users/...).然后,我在以下命令“git remote add origin...”中尝试了几个路径(值得注意的是,我首先尝试使用 README 文件所在的路径,从 c:/Users/... 开始)。 Now, when I write this precise bash command现在,当我编写这个精确的 bash 命令时

  git remote add origin git@github.com:dlib/OpenSourceContrib.git

I get我得到

  fatal: remote origin already exists

and when I write the next command,当我写下一条命令时,

  git push -u origin master

I have the following error我有以下错误

  ERROR: repository not found
  fatal: The remote ended up unexpectedly

I don't understand where this errors are coming from, how to remove for instance the remote origin to start from scratch again, or how to fix it.我不明白这个错误是从哪里来的,如何删除远程源以重新从头开始,或者如何修复它。

Btw, could you point to good quick reference to bash?顺便说一句,你能指出 bash 的快速参考吗?

Regards.问候。

Your question, command sequences and subsequent comments are not adding up.您的问题、命令序列和后续评论没有相加。 You apparently already have a repository in 'Hello-World' - suggesting you followed the GitHub instructions.您显然已经在“Hello-World”中拥有一个存储库 - 建议您遵循 GitHub 说明。 But now, when creating OpenSourceContrib, you appear to be in the 'Hello-World' source tree (with.git repository) - hence the 'origin already exists'.但是现在,在创建 OpenSourceContrib 时,您似乎位于“Hello-World”源代码树中(with.git 存储库)——因此“源已存在”。

Just start again.重新开始吧。 Create a new GitHub repository and carefully create your source code tree with local Git repository)创建一个新的 GitHub 存储库并使用本地 Git 存储库仔细创建您的源代码树)

You could also edit the text file.git/config and make your origin remote to point to the right location (here git@github.com:dlib/OpenSourceContrib.git ).您还可以编辑文本 file.git/config 并使您的origin远程指向正确的位置(此处为git@github.com:dlib/OpenSourceContrib.git )。

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

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