Powershell을 사용하여 홈 디렉토리에 Git 복제


0

나는 작업을하는 데 사용 cmd.exe상금 10 만, 최근에는 파워 쉘로 전환.
cmd.exe

cd %USERPROFILE%\example 

git clone https://github.com/user/example.git %USERPROFILE%\example  

의도 한대로 작동합니다. 이후 %USERPROFILE%PowerShell에서 작동하지 않습니다, 내가 사용하는 ~대신.

그러나 예를 들어 Powershell에 C:명령 cd ~/example을 입력하면 C:\Users\JohnDoe\example의도 한대로 폴더에있게됩니다 .

하지만 내가 달릴 때

git clone https://github.com/user/example.git ~/example

repo는 내 홈 디렉토리가 아니라에 복제됩니다 C:\~\example.

~Powershell에서 git clone 명령과 함께 사용할 수 있습니까?


git clone https://github.com/user/example.git $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath('~/example')
PetSerAl

또는 $env:userprofile대신 사용하십시오%userprofile%
SimonS

고맙습니다! 비록 $ExectionContext....일반적인 경로보다 더 많은 타이핑이 필요 하지만 ;) 나는 $env:userprofile지금 함께 갈 것이라고 생각 하지만, ~모든 경우에 작동 한다면 그것은 좋을 것입니다
jost21

나는 이것이 자식 때문이라고 생각합니까, 아니면 범인 Windows / Powershell입니까?
jost21

의도 한대로 작업 ~할 때 왜 사용해야 $env:userprofile합니까?
SimonS

답변:


0

이상하다. 먼저 디렉토리를 만든 다음 탭 완성을 사용할 수 있습니다. C:\> mkdir ~/example C:\> git clone https://github.com/user/example.git ~/ex<[Tab]> C:\> git clone https://github.com/user/example.git C:\Users\Josh\example

또는 $ HOME 변수를 사용하십시오. C:\> git clone https://github.com/user/example.git $HOME/example

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.