Git clone with a different username / account

This is a stupid question, but I’ve been looking for it for ages, and I can’t find anything, so I have to ask him.

How are you doing clonesomething gitwith a different account?

for example, if I logged in abcdefand I want to clone something in my account 12345, how do I do this?

I remember how it was done before: git clone url -l username. Then he would ask me password, and I would print it. But that either doesn't work anymore, or my brain is messing with me!

Thanks for the help.

+4
source share
1 answer

If you clone via https, you can do something like

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

A password prompt appears.

,

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

, .git/config bash , . , ssh.

+9

Source: https://habr.com/ru/post/1655501/


All Articles