Cannot clone github repo without being logged in as root, regardless of sudo

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


您必须在osxkeychain中删除您的github凭证,然后才能重新创建它们。


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.

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

  • 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)
    
  • 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
    
  • 链接地址: http://www.djcxy.com/p/40274.html

    上一篇: Docker容器中的sqlserver的连接字符串

    下一篇: 无论是否使用sudo,都无法以root身份登录,无法克隆github回购