3

I have got a Github organisation managed by my github account. All my repositories have been working well. When I create a new repository I set it as private and add my Github account as Collaborator. Suddenly all my repositories on all computers stopped "working". Everytime I want to pull or push a repository i get this error:

enter code hereremote: Repository not found. fatal: repository 'https://github.com/Organisation/Repository.git/' not found

It is the same with all repositories and clients I am working with. Even with newly created private repos.

My workflow when creating a new repo is

  1. Add the repo on Github Website and set it as private
  2. Add my Github Account as Collaborator
  3. On terminal switch into my repo folder.
  4. git init
  5. git remote add origin https://CopiedLinkToPrivateRepo
  6. git add .
  7. git commit -m 'my message'
  8. git push origin master
  9. Dang - repository not found

That workflow has worked for years now. Until a few weeks ago when it suddenly stopped working.

D0vev
  • 129
  • 2
  • 13
  • What is the output of `git remote -v`? – Tommy Nov 11 '16 at 16:39
  • `git remote -v`returns the current urls. Cant post them public because of the names. `origin https://github.com/orga/repo.git (fetch)` `origin https://github.com/orga/repo.git (push)` – D0vev Nov 11 '16 at 16:43
  • Excuse my double comment but when I change the remote url manually to `git remote set-url origin https://USERNAME@github.com/orga/repo.git` it is working. Is it possible that GitHub changed something am I am the only person on planet who did not get it? I had never to do this manually before. – D0vev Nov 11 '16 at 16:56
  • Switch to ssh keys and it should fix the problem. Have you verified with your git admin that he did not blocked https protocol? – CodeWizard Nov 11 '16 at 17:08
  • Yes the https protocoll is usable. I have tried it on different locations (at the office and at home). @CodeWizard are you talking about deploy keys? – D0vev Nov 11 '16 at 17:09
  • 1
    Nope a simple ssh keys. [http://stackoverflow.com/questions/31552549/github-private-team-separate-ssh-keys/31552753#31552753] – CodeWizard Nov 11 '16 at 17:12
  • @D0vev, Does your repo work good after changing https protocol to SSH protocol, as CodeWizard said? – lake Nov 14 '16 at 05:31
  • Yes, the solution with the SSH Keys is working well. I found another solution so I will post both solutions as answer. Thanks alot! – D0vev Nov 15 '16 at 10:51

1 Answers1

5

Thanks to CodeWizard.

For all searching people, there seem to be two solutions.

  1. Use SSH Keys to provide the credentials. Otherwise the private repositories can not be found. For any reason Git does not ask for credentials anymore without ssh keys.
  2. The secound way is to set your username into your remote url. As example: git remote set-url https://USERNAME@github.com/usernameOrOrganisation/repository.git. The Github website sometimes does not seem to provide the links with the username in it.
D0vev
  • 129
  • 2
  • 13
  • Nice one. For me your second option fixed it. It seems, GitHub sometimes has trouble when the local username in git does not fit to your username in GitHub – Mygeen Apr 11 '20 at 13:51