MrRoboto
MrRoboto

Reputation: 875

Git push fatal: repository not found

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.

Upvotes: 13

Views: 29380

Answers (9)

RSW
RSW

Reputation: 1376

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.

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

Upvotes: 0

user8331407
user8331407

Reputation:

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

Upvotes: 0

Hitesh Agarwal
Hitesh Agarwal

Reputation: 2005

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

Upvotes: 0

Sophart
Sophart

Reputation: 67

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 :)

Upvotes: 0

Davronbek Rahmonov
Davronbek Rahmonov

Reputation: 109

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.

Upvotes: 3

Mario Shtika
Mario Shtika

Reputation: 1476

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

Upvotes: 14

Raj Yadav
Raj Yadav

Reputation: 10768

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

Upvotes: 0

adrianvlupu
adrianvlupu

Reputation: 4618

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.

Upvotes: 12

Related Questions