Question

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.

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?

Était-ce utile?

La solution 2

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.

  1. Go to Tools -> Options
  2. Click on Authentication Tab
  3. Delete the other github account and add the new one

Autres conseils

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.

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

Set your remote to

https://YOUR_USER_NAME@github.com/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.

Or rather use SSH instead

ssh://git@github.com/YOUR_COMPANY_NAME/YOUR_REPO_NAME.git

as HTTPS is to be deprecated soon.

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

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

  1. Start menu
  2. Manage Network Passwords
  3. Removed my password for 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

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

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

Worked in Sourcetree: git@github.com:companyname/reponame.git

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

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

I was having the same Repository not found

Error

In my case i did the following steps:

  1. Sourcetree > Preferences
  2. Advanced
  3. Remove all usernames in the list
  4. Restart Sourcetree

I've had this a few times when it seems the Personal Access Token expires.

Regenerated the token in github (Your Profile -> Settings -> Security then find a link saying Personal Access Tokens) (don't forget to tick the appropriate boxes to grant permissions).

Then in SourceTree Tools -> Options -> Authentication and delete the accounts as others have said. Next time you try it you get a github username+password prompt. (Enter username and personal access token as the password.)

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

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.

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:

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

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

For me the issue seemed to be how the repo was cloned. I had a repo cloned by HTTPS and even though I had a valid SSH key + account (using oauth) it kept erroring out.

What I did to fix it was in the repo browser for SourceTree, I right clicked the repo and I selected "Convert to SSH".

After that it worked.

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

The server is bitbucket (instead of 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

  1. Check if you are using proper public key at github.com > Settings > SSH and GPG keys section and add your public key if it is not present there.

  2. Go to Terminal and use ssh -vT git@github.com command to check if all is fine and you are using same key for authorisation. If not, add proper key to Github account (id_ed25519 for example).

  3. Use SSH authentification in Sourcetree for your repository, if not – convert it to SSH. Go to Settings –> Remotes and check if it is like ssh://git@github.com/GIT_ACCOUNT_NAME/GIT_REPO_NAME.git

  4. Check Sourcetree –> Preferences –> Accounts that you are using OAuth authorisation and SSH protocol.

  5. In Sourcetree –> Preferences –> Git switch to system git.

  6. Good luck!

In November 2020 GitHub has changed how users authenticate when using Git for Windows, and now requires the use of a web browser to authenticate to GitHub. I updated Git for Windows to version 2.29.2.3 and solved the problem.

Convert the repo to SSH the issue might be that it would have been set to

sample-image

In my case, I had to allow SourcetreeForWindows for Third-party access at my organization i GitHub.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top