It is possible but, before git 2.9.3 (august 2016), a git push
would print the full url used when pushing back to the cloned repo.
That would include your username and password!
But no more: See commit 68f3c07 (20 Jul 2016), and commit 882d49c (14 Jul 2016) by Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit 71076e1, 08 Aug 2016)
push
: anonymize URL in status outputCommit 47abd85 (fetch: Strip usernames from url's before storing them, 2009-04-17, Git 1.6.4) taught fetch to anonymize URLs.
The primary purpose there was to avoid sticking passwords in merge-commit messages, but as a side effect, we also avoid printing them to stderr.The push side does not have the merge-commit problem, but it probably should avoid printing them to stderr. We can reuse the same anonymizing function.
Note that for this to come up, the credentials would have to appear either on the command line or in a git config file, neither of which is particularly secure.
So people should be switching to using credential helpers instead, which makes this problem go away.But that's no excuse not to improve the situation for people who for whatever reason end up using credentials embedded in the URL.