Git push fatal: repository not found
Asked Answered
T

9

13

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.

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.

Tullis answered 10/3, 2015 at 23:41 Comment(3)
There's always a chance somebody truly flattened the web server that's mediating access to your repository .. did you try the URL in a web browser just for kicks and giggles?Wite
Ya, I tried the url, as well as other repositories I have with bitbucket. The weird thing is it's working now and I have no idea why... I did not change anything or pull any updates it's just working. May have been a problem with bitbucket? Maybe I had some git file locked somewhere (I'm not super familiar with it's inner workings). Thanks for the help! It's always nice/frustrating when these issues resolve themselves.Tullis
Don't know why, but this worked for me: 1. git remote rm origin 2. Add repo with desired name in your github account 3. git remote add origin origin https://github.com/YOUR_USERNAME/NEW_REPO_NAME.git 4 `git push -u origin masterOverstrung
B
14

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.

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

Barabbas answered 21/11, 2017 at 8:10 Comment(0)
C
12

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

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

Cocksure answered 22/3, 2015 at 16:32 Comment(3)
You have a solution?Overthrust
Yes, go to bitbucket, copy the url to the repo again (the one ending with .git) and update the remote. I know he said he did it already, but I find myself pasting the wrong url more often than I like to admit.Cocksure
More specifically, these instructions from GitHub help, regardless which remote platform you're using help.github.com/articles/changing-a-remote-s-url/…Schubert
A
3

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 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.

Amabil answered 13/8, 2018 at 10:25 Comment(2)
In some cases when there's multiple environment branches and to run your Git command just basically means "don't test, just push your changes to master". I'm sure it works when you use 2 > branches.Dowling
saved me a nightmare. Thanks a ton...wasn't able to figure out what was happening even when I set-up a fresh repoCompony
H
0

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

Hemihedral answered 11/10, 2017 at 12:6 Comment(2)
Check what... ?Twopenny
Check whether https or ssh url ends with .git. If not its mercurial. In such case, delete the repository and create new one. AND DONOT FORGET TO CHECK "GIT REPOSITORY"Hemihedral
C
0

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:

List all old Remote URL

git remote -v

Removing old Repository 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 pull it may ask for merged changes on your local repository. Please pay attention with this step before you pull. And last of all you can push your latest changes. Hope it helps :)

Chromatology answered 16/8, 2018 at 5:32 Comment(0)
B
0

In my case, I have to log in my git account in the terminal. I follow the steps in the following link and then after it worked

https://kbroman.org/github_tutorial/pages/first_time.html

Belongings answered 11/7, 2020 at 15:34 Comment(0)
T
0

this type problem casually is from ssh url is cloned withow ssh promt and you give ssh url, if you give url by url : https://......git ...all ok

example by @Mario Shtika

Tientiena answered 11/7, 2020 at 15:53 Comment(0)
D
0

I got this error when I changed the directory name.

I solved the problem by editing the file config, setting the remote url to the new one. This file is inside .git directory of your project.

obs: I know that the problem related to this question has already been solved but I would like to register my solution here.

Dervish answered 15/11, 2020 at 14:8 Comment(0)
E
0

Make sure the user with whom you generated Github Personal Access Token (PAT) has the administrator access on the github repository.

We were trying to migrate the BitBucket repo along with all branches and commit history to Github enterprise but kept getting the error.

# Cloning the Bitbucket:
git clone --mirror http://[email protected]:7990/my-bb-repo.git

# Changing the origin:
git remote add GOrigin https://github.mycompany.com/MyCompanyOrg/destination.git

# Push to new origin:
git push --mirror https://github.mycompany.com/MyCompanyOrg/destination.git
remote: Repository not found.
fatal: repository 'https://github.mycompany.com/MyCompanyOrg/destination.git' not found

As soon as we switched the PAT created by repo admin user the issue was resolved.

Extender answered 28/1, 2022 at 13:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.