SourceTree - git:致命:远程错误:未找到存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21564211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:40:44  来源:igfitidea点击:

SourceTree - git: fatal: remote error: Repository not found

gitgithubatlassian-sourcetree

提问by Alaa Awad

I just signed up for a github account at work and created a new repository. I ran a few git commands over command line and everything worked fine.

我刚刚在工作中注册了一个 github 帐户并创建了一个新的存储库。我通过命令行运行了一些 git 命令,一切正常。

1. git init 
2. git add .
3. git commit -m "first commit"
4. git remote add origin https://github.com/username/project.git

Then, when I added the working copy from sourcetree and clicked the Fetch button, i get "error: Repository Not Found". I try push and pull and i get the same error. I've been using sourcetree with my bitbucket and github repositories for a few months now but i've never had this problem. Has anyone had similar issues?

然后,当我从 sourcetree 添加工作副本并单击 Fetch 按钮时,我收到“错误:未找到存储库”。我尝试推拉,但出现相同的错误。我几个月来一直在我的 bitbucket 和 github 存储库中使用 sourcetree,但我从来没有遇到过这个问题。有没有人遇到过类似的问题?

采纳答案by Alaa Awad

I figured it out the issue. I already had a a personal github account linked to sourcetree. When i deleted the personal github account and added the work account it worked fine.

我想通了这个问题。我已经有一个链接到 sourcetree 的个人 github 帐户。当我删除个人 github 帐户并添加工作帐户时,它运行良好。

  1. Go to Tools -> Options
  2. Click on Authentication Tab
  3. Delete the other github account and add the new one
  1. 转到工具 -> 选项
  2. 单击身份验证选项卡
  3. 删除另一个 github 帐户并添加新的

回答by stoefln

Had the same issue. The reason in my case was that I authenticated via https on command line but then used sourceTree via oAuth. Setting the Auth type to "Basic" in my Account settings helped.

有同样的问题。就我而言,原因是我在命令行上通过 https 进行了身份验证,然后通过 oAuth 使用了 sourceTree。在我的帐户设置中将身份验证类型设置为“基本”有帮助。

回答by WLCyPHlSpC

I have experienced the problem on Windows (8.1 x64) with a more subtle reason. The problem stemmed from the use of git authentication hooks, like the git-credential-winstore (https://gitcredentialstore.codeplex.com/).

我在 Windows (8.1 x64) 上遇到过这个问题,原因更微妙。问题源于使用 git 身份验证挂钩,例如 git-credential-winstore ( https://gitcredentialstore.codeplex.com/)。

In order for it to work i simply removed my network password to github like this:

为了让它工作,我简单地将我的网络密码删除到 github,如下所示:

  1. Start menu
  2. Manage Network Passwords
  3. Removed my password for http://github.com
  1. 开始菜单
  2. 管理网络密码
  3. 删除了我的http://github.com密码

If you want to entirely remove the git credential store this SO post which may be of help: https://stackoverflow.com/a/18376438

如果您想完全删除 git 凭证存储此 SO 帖子,这可能会有所帮助:https: //stackoverflow.com/a/18376438

回答by John Delvalle

I just had to set the current Account I wanted to use as SET TO DEFAULT on the path Tools/ Authentication Tab

我只需要在路径工具/身份验证选项卡上设置我想使用的当前帐户作为 SET TO DEFAULT

I was having the same Repository not found

我找不到相同的存储库

Error

错误

回答by Naloiko Eugene

Issue: I was trying to access the organisation's app using SourceTree. But a permission from organisation is needed.

问题:我试图使用 SourceTree 访问组织的应用程序。但是需要得到组织的许可。

The solution: I've installed GitHub Desktop application https://desktop.github.com/Authorized with needed account. It generated an additional SSH key (There were ssh keys for my account there already, and from terminal pull/push worked, but still GitHub Desktop added an additional one). And SourceTree started to display the needed private repository, started to push and pull as needed.

解决方案:我已经安装了 GitHub Desktop 应用程序https://desktop.github.com/使用所需帐户授权。它生成了一个额外的 SSH 密钥(那里已经有我的帐户的 ssh 密钥,并且从终端 pull/push 工作,但 GitHub Desktop 仍然添加了一个额外的密钥)。并且 SourceTree 开始显示所需的私有存储库,根据需要开始推送和拉取。

回答by carldevelopsforcoffee

I had a working git project for several months in source tree and this suddenly happened one day. I tried to check everything related to authentication and found this fix:

我在源代码树中有几个月的工作 git 项目,这突然发生在某一天。我尝试检查与身份验证相关的所有内容并找到了此修复程序:

On the project window, right click your project, click "Convert to SSH". I might have accidentally set it to "Convert to HTML" which caused the "Repository not found error".

在项目窗口中,右键单击您的项目,单击“转换为 SSH”。我可能不小心将它设置为“转换为 HTML”,这导致了“未找到存储库错误”。

Hope this helps guys that have a working setup, working accounts, working ssh authentications, and yet suddenly encounters this error.

希望这可以帮助那些拥有有效设置、有效帐户、有效 ssh 身份验证但突然遇到此错误的人。

回答by Knogobert

Simple solution for me was that because the repo was a private repo. I had to append my username and a at-symbol before the git URL.

对我来说简单的解决方案是因为 repo 是一个private repo。我必须在 git URL 之前附加我的用户名和 at 符号。

Set your remote to

将您的遥控器设置为

https://[email protected]/YOUR_COMPANY_NAME/YOUR_REPO_NAME.git

instead of

代替

https://github.com/YOUR_COMPANY_NAME/YOUR_REPO_NAME.git

Then enter your github user password upon eventual request.

然后根据最终要求输入您的 github 用户密码。

回答by Troy

In my case, it was because I was using HTTPS in stead of SSH as the remote repository path in SourceTree (Settings > Remotes).

就我而言,这是因为我使用 HTTPS 而不是 SSH 作为 SourceTree(设置 > 远程)中的远程存储库路径。

Didn't work in Sourcetree:https://github.com/companyname/reponame.git

在 Sourcetree 中不起作用:https://github.com/companyname/reponame.git

Worked in Sourcetree:[email protected]:companyname/reponame.git

在 Sourcetree 工作过:[email protected]:companyname/reponame.git

To get the latter from GitHub, click Clone or downloadthen Use SSH

要从 GitHub 获取后者,请单击Clone or downloadthenUse SSH

回答by mazy

In my case i did the following steps:

就我而言,我执行了以下步骤:

  1. Sourcetree > Preferences
  2. Advanced
  3. Remove all usernames in the list
  4. Restart Sourcetree
  1. Sourcetree > 首选项
  2. 先进的
  3. 删除列表中的所有用户名
  4. 重启源码树

回答by Hong

I run into the similar problem and it turns out it is because ssh authentication.

我遇到了类似的问题,结果证明是因为 ssh 身份验证。

The server is bitbucket (instead of git.com).

服务器是 bitbucket(而不是 git.com)。

So for that, Bitbucket needs users to establish identification before pushing commits (even though it doesn't request authentication while pulling it into local machines). The solution is to : step1: create keys in your local machine. $ssh-keygen -t rsa step2: copy the public key to the Bitbucket $cat ~/.ssh/id_rsa.pub copy the key to profile->account->SSH keys->Add key

因此,为此,Bitbucket 需要用户在推送提交之前建立标识(即使它在将其拉入本地机器时不请求身份验证)。解决方法是: step1:在本地机器上创建密钥。$ssh-keygen -t rsa step2:将公钥复制到Bitbucket $cat ~/.ssh/id_rsa.pub 将密钥复制到profile->account->SSH keys->Add key