About the problem that git pull requires a password
滿天的星座
滿天的星座 2017-05-02 09:23:45
0
6
721

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

滿天的星座
滿天的星座

reply all(6)
给我你的怀抱

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

巴扎黑

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

迷茫

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

世界只因有你

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

左手右手慢动作

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

黄舟

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template