【问题标题】:How can i set up the ssh to my computer for github?如何将 ssh 设置到我的计算机的 github?
【发布时间】:2019-10-31 12:22:27
【问题描述】:

我尝试使用此tutorial 设置我的 ssh,但无法正常工作,我总是遇到同样的错误。怎么设置?

我有这些钥匙:

user@LAPTOP-LC8KG6GU MINGW64 ~/Documents/programmi_prove/helloworld_project (master)
$ ls -al ~/.ssh
total 32
drwxr-xr-x 1 user 197609    0 giu 17 16:02 ./
drwxr-xr-x 1 user 197609    0 giu 17 17:13 ../
-rw-r--r-- 1 user 197609 3389 giu 17 23:12 id_rsa
-rw-r--r-- 1 user 197609  748 giu 17 23:12 id_rsa.pub

这些是我的错误:

user@LAPTOP-LC8KG6GU MINGW64 ~/Documents/programmi_prove/helloworld_project (master)
$ git remote add origin https://github.com/speranza493/firstapp.git
fatal: remote origin already exists.

user@LAPTOP-LC8KG6GU MINGW64 ~/Documents/programmi_prove/helloworld_project (master)
$ git remote add origin https://github.com/speranza493/firstapp.git/
fatal: remote origin already exists.

user@LAPTOP-LC8KG6GU MINGW64 ~/Documents/programmi_prove/helloworld_project (master)
$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/speranza493/firstapp.git/' not found

【问题讨论】:

  • git remote -v 的输出是什么?
  • 这是“git remote -v”的输出: * origin github.com/speranza493/firstapp.git (fetch) * origin github.com/speranza493/firstapp.git (push)
  • 试试这个git branch --set-upstream <remote-branch>,然后git push,你得到了什么?我注意到的一件事是,在您的远程网址末尾有一个额外的/..... firstapp.git/ 确保您指向正确的网址
  • @WilliamKinaan 与“git branch --set-upstream-to github.com/speranza493/firstapp.git”,我有这个:错误:请求的上游分支'github.com/speranza493/firstapp.git'不存在提示:提示:如果你正在计划将您的工作基于上游提示:远程已经存在的分支,您可能需要提示:运行“git fetch”来检索它。提示:提示:如果您计划推出一个新的本地分支,提示:将跟踪其远程副本,您可能需要使用提示:“git push -u”在您推送时设置上游配置。
  • 您执行了错误的命令。假设您在master 分支请尝试git branch --set-upstream origin master

标签: windows git github ssh key


【解决方案1】:

你的 repo url 改变了吗?使用git remote rm origin 移除遥控器,然后使用git remote add origin YOURURLHERE 读取它

【讨论】:

  • 我已经做到了,但它和以前一样犯了同样的错误。我使用的网址是从 github 复制的
  • @MarcoSperanza 是私人回购吗?我尝试关注您的网址,但该页面不存在。
猜你喜欢
  • 1970-01-01
  • 2013-11-28
  • 1970-01-01
  • 1970-01-01
  • 2010-11-26
  • 1970-01-01
  • 2021-04-03
  • 2013-09-03
  • 2014-03-17
相关资源
最近更新 更多