1

I've run Enter-PSSession successfully to connect to a remote server, and run several commands successfully too, like git add -u and git commit -m "xxx" etc.

but when trying to push the code using git push command, the shell then blocked forever unless exit with "Ctrl+C".

however I can remotely run git push from remote desktop program successfully without inputing any password.

is it because inputing username and password is needed in this case?

any way to solve/workaround it? thanks

aaron
  • 1,951
  • 3
  • 27
  • 41
  • What authentication do you have on your GIT server? Where/how is your GIT hosted? It's probably waiting for you enter enter credentials that you don't have to locally because they're cached. – Liam Jan 24 '19 at 14:05
  • should be, the "credential.helper" is "manager" – aaron Jan 25 '19 at 00:59

1 Answers1

0

You can provide the username and password in the Git URL, either by configuring it in the config in advance:

git config remote.origin.url https://username:password@somegiturl.com/somerepo/somerepo.git

or within your push:

git push https://username:password@somegiturl.com/somerepo/somerepo.git
Mark Wragg
  • 22,105
  • 7
  • 39
  • 68
  • the second command does not work, where i changed https to http, because our server uses http right now. ```` git : fatal: Win32Exception encountered. + CategoryInfo : NotSpecified: (fatal: Win32Exception encountered.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError Failed to write credentials Everything up-to-date ```` – aaron Jan 25 '19 at 01:08
  • the first command may cause credential problem because the computer is shared by a team – aaron Jan 25 '19 at 01:10
  • Oh, actually the second command works, thought it reports some error. thanks, this solves my problem – aaron Jan 25 '19 at 02:01
  • Yeah beware git has a tendency to return non error states in a way that PowerShell thinks is an error. – Mark Wragg Jan 25 '19 at 03:42