如何在运行时提供用户名和密码“git clone git@remote.git”? [英] How to provide username and password when run "git clone git@remote.git"?

查看:118
本文介绍了如何在运行时提供用户名和密码“git clone git@remote.git”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何为https请求提供用户名和密码,如下所示:

  git clone https://用户名:password @ remote 

但是我想知道如何为远程提供用户名和密码像这样:

  git clone git@remote.git 

我试过这样的:

  git clone username:password @ git@remote.git 
git clone git @ username:password@remote.git
git clone git @ remote.git @ username:password

但他们没有成功。

  

解决方案code> git clone https:// username:password@github.com/username/repository.git

这种方法可以从github仓库中为我工作



基于Michael_Scharf的评论编辑

您可以省去密码,以便它不会记录您的bash历史记录文件:

  git克隆https://username@github.com/username/repository.git 

它会提示您输入密码


I know how to provide a username and password to an https request like this:

git clone https://username:password@remote

But I'd like to know how to provide a username and password to the remote like this:

git clone git@remote.git

I've tried like this:

git clone username:password@git@remote.git
git clone git@username:password@remote.git
git clone git@remote.git@username:password

But they haven't worked.

解决方案

git clone https://username:password@github.com/username/repository.git

This way worked for me from a github repository

Edit based on Michael_Scharf's comment:

You can leave out the password so that it won't be logged your bash history file:

git clone https://username@github.com/username/repository.git

It will prompt you for your password

这篇关于如何在运行时提供用户名和密码“git clone git@remote.git”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆