【发布时间】:2018-05-02 07:02:54
【问题描述】:
在学习 git 的过程中,我在 GitHub 上建立了一个私有存储库。我已经创建了 ssh 密钥并将其存储到我的 GitHub 帐户并在我的本地 Linux 机器上编辑了 .ssh/config 文件:
## github
Host github.com
User git
HostName github.com
IdentityFile ~/.ssh/github.key
我可以成功连接到我的 GitHub 帐户:
$ ssh -T github
Hi <UserName>! You've successfully authenticated, but GitHub does not provide shell access.
我已经在本地机器上初始化了一个 git 仓库,设置了用户并添加了一个远程仓库:
$ git init
$ git config user.name "UserName"
$ git config user.email "UserEmail"
$ git remote add origin ssh://github:<UserName?/<repositoryName>.git
我创建了一个README.md 文件,将其添加到 git 并提交:
$ git add README.md
$ git commit -m "First commit."
现在每次我尝试推送时,都会收到此错误:
$ git push origin master
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
克隆存储库有效,但这是我唯一能做的。
为什么我不能推送到我的私有仓库?我做错了什么?
【问题讨论】:
-
输入
git remote -v会得到什么 -
我收到与
push命令相同的错误。
标签: linux git github ssh ssh-keys