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
Push as same username, but to different github accounts After this, if you'll push using git push -u origin-username master , this will prompt you for the password. This is a good trick for multi accounts.
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? Have you tried using the whole remote URL? Yes, I've tried it. Usually I copy-paste from "git remote -va". It works, though it creates an additional remote tracking branch on pulls.
You can push to git repository which is on remote ssh server using git. You can configure remote repository as a git remote to be able access quickly using remote (short) name.
server is remote configured using git remote command master is the branch to push When you push changes, you will be prompted for the password. You can configure ssh keys to bypass password authentication when you push changes.
If you use different windows user, your SSH key and git settings will be independent. If this is not an option for you, then your friend should add your SSH key to her Github account. Although, previous solution will keep you pushing as yourself, but it will allow you to push into her repo.
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
Once you've done the commit, you can use the following syntax:
git push https://<username>@github.com/<github repository> <local branch name>:<remote branch name>
You'll be asked for your github password to process the push.
For example, if your github username is "foobar", the repository clone url is "https://github.com/bar/ish.git", and the local and remote branches are named "nonce", you can use the following:
git push https://[email protected]/bar/ish.git nonce:nonce
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With