search

Home  >  Q&A  >  body text

About the problem that git pull requires a password

I am a little confused when I am new to git
When I enter git pull, I need a password. And I use the login password for this password, but it always prompts an error.
No password required if I specify a remote repository

滿天的星座滿天的星座2812 days ago729

reply all(6)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:25:45

    It’s because I upgraded to Windows 10 and changed the previous environment variables. The windows client of git requires a HOME的环境变量

    在没有升级之前是有这个环境变量的。
    %USERPROFILE%指向的是本地的个人目录,而.ssh文件夹就在这个个人目录里,如果没有HOME环境变量。git就会拿不到这个私钥。所以会一直认证失败。而且没有HOME这个环境变量。生成ssh key and will also report an error. Prompt that the directory cannot be found

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-02 09:25:45

    Git has nothing to do with passwords.
    Git basically does not involve account management
    Whatever protocol you use to access git is the protocol you use to authenticate
    http or ssh can be used
    When you git pull, it must be the password of your remote access protocol

    reply
    0
  • 迷茫

    迷茫2017-05-02 09:25:45

    It should be that you added the password when configuring the SSH key

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-02 09:25:45

    Change to public key authentication, so you don’t have to enter the password every time

    reply
    0
  • ringa_lee

    ringa_lee2017-05-02 09:25:45

    If you have configured ssh but it does not take effect, do you have multiple accounts on git? Then try this method:

    • $ cd ~/.ssh

    • vi config

    Host gitosc1
    HostName oschina.net
    User git
    IdentityFile ~/.ssh/id_rsa

    Host gitosc2
    HostName oschina.net
    User git
    IdentityFile ~/.ssh/id_rsa2

    • Modify remote address

    $ git remote add origin git@gitosc1:user1/project1.git
    $ git remote add origin git@gitosc2:user2/project2.git

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:25:45

    I think you set up SSH on the remote side?
    Is that so?

    reply
    0
  • Cancelreply