7

Running on OSX ->

git clone https://github.com/.../project.git
Cloning into 'project'...
remote: Repository not found.
fatal: repository 'https://github.com/.../project.git/' not found

...:repos ...$ sudo git clone https://github.com/.../project.git
Cloning into 'project'...
remote: Repository not found.
fatal: repository 'https://github.com/.../project.git/' not found


...:repos ...$ sudo su


sh-3.2# git clone https://github.com/.../project.git
Cloning into 'project'...
remote: Counting objects: 122, done.
remote: Compressing objects: 100% (93/93), done.
remote: Total 122 (delta 28), reused 114 (delta 20), pack-reused 0
Receiving objects: 100% (122/122), 364.08 KiB | 0 bytes/s, done.
Resolving deltas: 100% (28/28), done.

Another weird thing about this is that this is a private repo and it does not ask for my password when I'm root. I assume it is stored somewhere.

EDIT : the solution is to delete the existing keychain element in the osx keychain

Code Wiget
  • 1,540
  • 1
  • 23
  • 35
  • 5
    The OS X credential helpers for Git use the OS X keychain routines to provide https credentials. sudo apparently has no effect on keychain info. – torek Aug 16 '17 at 14:50
  • @torek so what do I do to fix this – Code Wiget Aug 16 '17 at 15:16
  • 1
    I don't know, I'm no expert on OS X keychain. (I normally use ssh access anyway since it works from all systems.) – torek Aug 16 '17 at 16:34
  • What happen when you run sh command in terminal and run git again? – Samuel Tulach Aug 18 '17 at 18:16
  • @SamuelTulach When run with sh I get the same not found output: sh-3.2$ git push remote: Repository not found. fatal: repository ... not found – Code Wiget Aug 18 '17 at 20:14
  • @Ryan Did you before add any login details to git with root (sudo) enabled? – Samuel Tulach Aug 19 '17 at 06:57
  • @SamuelTulach I'm not sure, is there any way that I could remove them if I did? – Code Wiget Aug 19 '17 at 13:24
  • @Ryan https://stackoverflow.com/questions/11067818/how-do-you-reset-the-stored-credentials-in-git-credential-osxkeychain also try to reset cache. – Samuel Tulach Aug 19 '17 at 13:51
  • @torek can some helper bash command can fix this? – Subomi Aug 21 '17 at 12:12
  • @SamuelTulach Thank you for your help. When I saw your post it mentioned to possibly reset the osx keychain by deleting the existing credentials, and that worked! Then I just had to run a chown on the directory and I was good to go! If you post this as an answer I will accept it. – Code Wiget Aug 21 '17 at 13:33
  • Does anything from this page help? https://help.github.com/articles/caching-your-github-password-in-git/ – Scott Newson Aug 21 '17 at 18:50
  • @ScottNewson, I found the solution. The problem is the osx keychain and you have to delete your credentials and remake them. I have asked Samuel to post an answer but torek also helped so whoever posts first I will accept. – Code Wiget Aug 22 '17 at 13:52
  • @Ryan you can also an answer yourself and accept it if you like – Scott Newson Aug 22 '17 at 21:01
  • There is a bounty and i would like it to go to one of those two – Code Wiget Aug 22 '17 at 23:24

2 Answers2

3

You have to delete your github credentials in osxkeychain, and then you can recreate them.

Scott Newson
  • 2,745
  • 2
  • 24
  • 26
0

I think you are still logged but not with the good account for accessing to your project. For that reason, github doesn’t ask you your credential (username/password) and fail when trying to access to your project.

  1. So, if credential.helper is set with osxkeychain you can reset your GitHub element in the osxkeychain. Credential helper is used for remembering GitHub credentials. Especially, on Mac OSX 10.7 and above, osxkeychain helper is automatically included in your Git installation.

  2. Then you can also do not use the osxkeychain credential helper by unsetting it:

    git config --global --unset credential.helper
    (--system should be unset if your credential helper is set here)
    
  3. Otherwise, if you have already not credential.helper set You should unset github.user and github.token

    $git config --global --unset github.user
    $git config --global --unset github.token
    
Fabien Leborgne
  • 377
  • 1
  • 5
  • 1
    what exactly is a github user, token, and credentiel helper? For example, github.user is either my github username or my computer username, and I have no idea what I would put for token and credential helper... even githubs documentation isn't clear : https://git-scm.com/docs/gitcredentials – Code Wiget Aug 21 '17 at 13:24
  • 1
    Thank you for your answer. The solution is not what you described: the solution is to delete the existing keychain element in the osx keychain. If you update your answer with the correct answer, I will accept the answer and award you the reputation. The bounty expires in 1 day or it is lost. – Code Wiget Aug 24 '17 at 15:06
  • @Ryan Created a separate answer with your actual solution. – Scott Newson Aug 25 '17 at 17:14