git Git推送致命:未找到存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28976109/
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-19 10:49:13  来源:igfitidea点击:

Git push fatal: repository not found

gitbitbucketatlassian-sourcetree

提问by MrRoboto

I'm not sure what is going on. But every time I try to push or pull now with git I get this message "fatal: repository 'https://....' not found". I usually use source tree with bitbucket but am receiving the same error when I try from the command line.

我不确定发生了什么。但是每次我现在尝试使用 git 推送或拉取时,都会收到此消息“致命:未找到存储库‘https://....’”。我通常将源树与 bitbucket 一起使用,但是当我从命令行尝试时收到相同的错误。

The reason I'm so confused is I haven't done anything that should change the repository. This repository has had hundreds of commits from me and other team members and nothing has changed since we created it. We rarely use any advance features not even branching, just pull, push, commit, and merge. Any what could have happened and how to fix it?

我如此困惑的原因是我没有做任何应该更改存储库的事情。这个存储库有数百次来自我和其他团队成员的提交,自我们创建以来没有任何变化。我们很少使用任何高级功能,甚至不使用分支,只使用拉、推、提交和合并。任何可能发生的事情以及如何解决它?

I've already tried removing and re-adding the origin but no luck.

我已经尝试删除并重新添加原点,但没有成功。

回答by adrianvlupu

This kind of thing happens when the repo, team name or username changes.

当 repo、团队名称或用户名发生变化时,就会发生这种事情。

Happened to me when I changed the team name and all of the repos lost their origin.

当我更改团队名称并且所有 repos 都失去了它们的来源时,发生在我身上。

回答by Mario Shtika

As mentioned above this happens when the repository, team name or username changes. The solution is to set the new remote url, as shown below.

如上所述,当存储库、团队名称或用户名更改时,就会发生这种情况。解决办法是设置新的远程url,如下图。

git remote set-url origin https://______________.git

git remote set-url origin https://______________.git

回答by Davronbek Rahmonov

I think, my answer can save someone a few minutes and some nerves.

我认为,我的回答可以为某人节省几分钟和一些紧张。

I ran into the same issue. Solved the problem by running the following Git command:

我遇到了同样的问题。通过运行以下 Git 命令解决了问题:

git push --set-upstream origin master

The reason: When you initialize git repository to local working directory, Git only initializes "origin", and has no upstream set to commit your changes.

原因:当您将 git 存储库初始化到本地工作目录时,Git 仅初始化“origin”,并且没有上游设置来提交您的更改。

回答by Sophart Phun

I have also faced that problem, and this was because I have renamed the repository on my bitbucket account. The solution is to adding a new remote url to your local repository using below command:

我也遇到过这个问题,这是因为我在我的 bitbucket 帐户上重命名了存储库。解决方案是使用以下命令将新的远程 url 添加到本地存储库:

List all old Remote URL

列出所有旧的远程 URL

git remote -v

Removing old Repository URL

删除旧的存储库 URL

git remote remove <old name>

Adding new URL

添加新网址

git remote add <new url>

Final Step

最后一步

git pull <new url>
git push

The final step when you pullit may ask for merged changes on your local repository. Please pay attention with this step before you pull. And last of all you can pushyour latest changes. Hope it helps :)

最后一步,您pull可能会要求对本地存储库进行合并更改。请在此之前注意这一步pull。最后,您可以进行push最新更改。希望能帮助到你 :)

回答by Raj Yadav

This usually occurs when you try to add Mercurial Repoto git. Check

这通常发生在您尝试将Mercurial Repo添加到 git 时。查看