fatal: could not read Username for 'https://github.com': No such file or directory

前端 未结 17 1271
自闭症患者
自闭症患者 2020-12-02 18:13

I have the following problem when I try to pull code using git Bash on Windows:

fatal: could not read Username for \'https://github.com\': No such file or dir         


        
相关标签:
17条回答
  • 2020-12-02 18:19

    For those getting this error in a Jenkins pipeline, it can be fixed by using an SSH Agent plugin. Then wrap your git commands in something like this:

    sshagent(['my-ssh-key']) {
        git remote set-url origin git@github.com:username/reponame.git
        sh 'git push origin branch_name'
    }
    
    0 讨论(0)
  • 2020-12-02 18:21

    Follow the steps to setup SSH keys here: https://help.github.com/articles/generating-ssh-keys

    OR

    git remote add origin https://{username}:{password}@github.com/{username}/project.git
    
    0 讨论(0)
  • 2020-12-02 18:21

    Try using a normal Windows shell such as CMD.

    0 讨论(0)
  • 2020-12-02 18:22

    I found my answer here:

    edit ~/.gitconfig and add the following:

    [url "git@github.com:"]
     insteadOf = https://github.com/
    

    Although it solves a different problem, the error code is the same...

    0 讨论(0)
  • 2020-12-02 18:26

    Note that if you are getting this error instead:

    fatal: could not read Username for 'https://github.com': No error
    

    Then you need to update your Git to version 2.16 or later.

    0 讨论(0)
  • 2020-12-02 18:29

    Replace your remote url like this:

    git remote set-url origin https://<username>@github.com/<username>/<repo>.git
    
    0 讨论(0)
提交回复
热议问题