如何暂时更改git ssh用户进行远程推送? [英] How to change git ssh user for a remote push temporarily?

查看:101
本文介绍了如何暂时更改git ssh用户进行远程推送?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以暂时改变ssh用户的git push remote master而不用搞乱.git / config或git remote,或者使用整个远程url?

Is it possible to change the ssh user temporarly for a "git push remote master" without messing up with .git/config or "git remote", or using the whole remote url?

[root@host gitrepo]# git push otheruser@remote master # this does not work, but how great it would be
[root@host gitrepo]# USER=otheruser git push remote master # still asks password for root


推荐答案

您是否尝试过使用整个远程URL?

Have you tried using the whole remote URL?

git push ssh://<temp_user>@<host>/<repo_path> <local_branch>:<remote_branch>

,系统会提示您提供密码

and you will be prompted to provide the password

这篇关于如何暂时更改git ssh用户进行远程推送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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