使用git remote add origin在GitHub上创建新的远程存储库 [英] Creating a new remote repository on GitHub using git remote add origin

查看:333
本文介绍了使用git remote add origin在GitHub上创建新的远程存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了Git教程,但被困在创建新的远程存储库中.

I following a Git tutorial and I've got stuck on the creation of a new remote repository.

我了解到命令 git remote add origin 将在 https://github.com/natalisilverio/,但是访问我的存储库列表,我可以看到它不是创建的.

I've understood that the command git remote add origin would create a new repo named testingGit on https://github.com/natalisilverio/ but visiting the list of my repositories I can see that it was not created.

我的目的是学习如何使用 terminal 而不是在github.com中创建远程存储库.那可能吗?如果是,我在做什么错?

My intention is to learn how to create a remote repository using terminal and not in github.com. Is that possible? If if yes, what I am doing wrong?

以下是我在终端中输入的全部代码:

Here follows the entire code I typed in terminal:

git init

git remote add origin https://github.com/natalisilverio/testingGit.git

git add test.rtf

git commit -m "adding test.rtf"

git remote add origin https://github.com/natalisilverio/testingGit.git 

git push -u origin master (and then I provide my user and password)

remote: Repository not found.
fatal: repository 'https://github.com/natalisilverio/testingGit.git/' not found

非常感谢您

推荐答案

命令 git remote add origin 不会在github上创建新的存储库.

The command git remote add origin will not create a new repository on github.

添加远程只是说这里是该存储库的另一个副本的URL".为了满足此要求,您仍然需要首先在github上创建存储库.

Adding a remote is simply saying "here is a URL to another copy of this repository". In order to satisfy this you would still need to have created the repository on github first.

以这种方式在github上创建存储库并不常见,但是可以通过 Github API .

Creating a repository on github in this way is not a common usage, but it is possible via the Github API.

更有可能,您将希望首先在github上创建存储库,然后在本地克隆它.或者,如果您已经有一个本地项目,则可以在Github上(通过Web界面)创建一个新的存储库,然后将您的项目添加到其中.请参见将现有项目添加到GitHub使用命令行.

More likely, you will want to create your repository first on github and then clone it locally. Or if you already have a local project, you can create a new repository on Github (via the web interface) and add your project to it. See Adding an existing project to GitHub using the command line.

这篇关于使用git remote add origin在GitHub上创建新的远程存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆