Stu*_*ike 2 git github git-remote
我想从我的 shell 添加远程存储库但失败了。我已登录并在我的本地存储库中。所以我输入这个:
% git remote add origin https://github.com/<username>/example.git
% git remote -v
origin https://github.com/<username>/example.git (fetch)
origin https://github.com/<username>/example.git (push)
Run Code Online (Sandbox Code Playgroud)
所以似乎已经创建了repo。但是我在我的 github 帐户中没有看到新的 repo。当我尝试检查遥控器(或在那里推送任何东西)时,它会引发错误:
% git remote show origin
remote: Repository not found.
fatal: repository 'https://github.com/<username>/example.git/' not found
Run Code Online (Sandbox Code Playgroud)
我尝试谷歌搜索类似的问题,但找不到答案。有谁知道我可能会错过什么?
git remote add
不会“在 github 上创建存储库”,它只会将您的本地存储库链接到 github 上的(现有)远程存储库。
如果example.git
github上不存在,则需要先创建它(例如:example
通过github的网站创建一个空的repo)。
之后,您的常规 git 命令将起作用(push
, pull
, remote show
...)。