Git clone using http with user and password

2019-06-19 13:34发布

I try to use git clone http://user:password@host.com but I have some problems with adding user or password because the user is using email which contains an other @ and password is using an esclamation mark ( ! )

the command looks like http://user@home.com:!password@host.com/git

This is not working - I tried 0x21password instead of !password but the system don't except this.

Any idea?

标签: git http
2条回答
虎瘦雄心在
2楼-- · 2019-06-19 14:24

This is pretty old question but let me add the workaround for benefits of others. We recently started using email id as username to connect to Git, but pull/fetch/push etc commands started failing. We tried %40 as suggested in previous comments but it didnt work. So we created ~/.netrc file with following information.

machine git.myserver.com login username@myserver.com password mypassword

We also removed username from the url which gets stored in .git/config file. And we could now do pull/commit etc. Its not advisable to use this approach because password is stored in plain text in a file but that was a quick workaround to make urgent commit while looking for ways to connect using email id from command line tool.

查看更多
登录 后发表回答