Git 对存储库的远程匿名访问被拒绝?

Git 对存储库的远程匿名访问被拒绝?,git,github,Git,Github,我使用的是Ubuntu12.04 LTS,刚刚将我的git从1.7升级到1.8.4。问题是,当我想要推送到GitHub存储库时,我收到以下消息,但推送没有发生: /caniuse $ git push Username for 'https://github.com': rafalchmiel Password for 'https://rafalchmiel@github.com': remote: Anonymous access to rafalchmiel/caniuse.git de

我使用的是Ubuntu12.04 LTS,刚刚将我的
git
1.7
升级到
1.8.4
。问题是,当我想要推送到GitHub存储库时,我收到以下消息,但推送没有发生:

/caniuse $ git push
Username for 'https://github.com': rafalchmiel
Password for 'https://rafalchmiel@github.com': 
remote: Anonymous access to rafalchmiel/caniuse.git denied.
fatal: Authentication failed for 'https://github.com/rafalchmiel/caniuse.git/'
这是我从git config--list中得到的:

user.name=Rafal Chmiel
user.email=rafalmarekchmiel@gmail.com
alias.undo-commit=reset --soft HEAD^
color.ui=true
push.default=matching
credential.helper=cache --timeout=86400
github.user=rafalchmiel
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://github.com/rafalchmiel/caniuse.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
这些是我的遥控器(
git-remote-v
):


我再次尝试设置SSH密钥(尽管这是通过HTTP完成的),并搜索选项。不走运。关于我还能做什么有什么想法吗?

问题没有解决,但最终我决定使用SSH而不是HTTPS。SSH根本没有引起任何问题(并且不需要输入用户名和密码)

我遇到了一个类似的问题,在寻找答案的过程中遇到了这个问题

解决了这个问题

  • 在不添加任何文件的情况下使用命令
    git push
    ,可能会出现此错误
  • 使用命令
    gitpush
    而不添加任何提交,也可以执行相同的操作
  • 因此,简单的解决办法是遵循这一点

    git add --all .
    git commit
    git push
    

    我之所以出现这个问题,是因为我启用了2-Factor-Auth,它要求的密码是生成的密码/个人访问令牌,而不是我的LDAP密码。我不记得当时是我设置的

    创建个人访问令牌:,允许我使用生成的令牌作为密码成功推送


    上下文:内部托管的企业Github。能够克隆,作为协作者启用,但无法推送源主机。

    如果要使用SSH密钥,必须使用以下格式:

    $ <snip> on MBP-0x00A3 in ~/misc/vim_dotfiles
    ✭ (git) working on branch alternate ✔
    ❯❯ git remote -v
    origin  https://github.com/<snip>/vim_dotfiles.git (fetch)
    origin  https://github.com/<snip>/vim_dotfiles.git (push)
    
    $ <snip> on MBP-0x00A3 in ~/misc/vim_dotfiles
    ✭ (git) working on branch alternate ✔
    ❯❯ git remote add personal git@github.com:<snip>/vim_dotfiles.git
    
    $ <snip> on MBP-0x00A3 in ~/misc/vim_dotfiles
    ✭ (git) working on branch alternate ✔
    ❯❯ git remote -v
    origin  https://github.com/<snip>/vim_dotfiles.git (fetch)
    origin  https://github.com/<snip>/vim_dotfiles.git (push)
    personal    git@github.com:<snip>/vim_dotfiles.git (fetch)
    personal    git@github.com:<snip>/vim_dotfiles.git (push)
    
    ~/misc/vim_dotfiles中MBP-0x00A3上的
    $
    ✭ (git)在分支机构上工作✔
    ❯❯ git远程-v
    起源https://github.com//vim_dotfiles.git (取回)
    起源https://github.com//vim_dotfiles.git (推)
    ~/misc/vim_dotfiles中MBP-0x00A3上的$
    ✭ (git)在分支机构上工作✔
    ❯❯ git远程添加个人git@github.com:/vim_dotfiles.git
    ~/misc/vim_dotfiles中MBP-0x00A3上的$
    ✭ (git)在分支机构上工作✔
    ❯❯ git远程-v
    起源https://github.com//vim_dotfiles.git (取回)
    起源https://github.com//vim_dotfiles.git (推)
    个人的git@github.com:/vim_dotfiles.git(获取)
    个人的git@github.com:/vim_dotfiles.git(推送)
    
    现在您可以执行以下操作:

    user@host:~$ git push personal <branch>
    
    user@host:~$git个人推送
    

    它将强制使用您的SSH密钥。

    我和您有同样的问题。但你有点不同

    Username for 'https://www.github.com': xxxx@gmail.com
    Password for 'https://xxxx@gmail.com@www.github.com':
    remote: Anonymous access to xxxxx.git denied.
    fatal: Authentication failed for 'https://www.github.com/yyyy/xxx
    
    我发现问题的原因是我克隆了前缀为www
    https://www.github.com/yyyy/xxx


    我通过git再次克隆存储库解决了这个问题,就像这样
    https://github.com/yyyy/xxx
    ,一切正常。

    想一想,您是否尝试过将遥控器更改为使用SSH链接?非常感谢您的建议,我尝试了一下,很快就成功了。我要永远抛弃HTTPS!SSH FTW.+2,真的,在浪费了相当一段时间之后,这解决了它!SSH给我带来了其他问题。很好,除了我的组织阻止了端口22,所以SSH不是一个选项:-(@xtopolis下面的答案(个人访问令牌)有效:-)@raf我现在发布了一个答案,希望它能帮助人们,如果他们想用SSHIt发帖的话!非常感谢,克斯托波利斯。我的上下文与您的略有不同:我启用了2-Factor-Auth,但我在Linux上使用IntelliJ 2017.2.5。再次感谢你,奥兰多。
    Username for 'https://www.github.com': xxxx@gmail.com
    Password for 'https://xxxx@gmail.com@www.github.com':
    remote: Anonymous access to xxxxx.git denied.
    fatal: Authentication failed for 'https://www.github.com/yyyy/xxx