我想运行一个PowerShell脚本自动推送到GIT每隔一段时间。尝试提交到GitHub使用PowerShell导致错误“致命:无法访问'Microsoft.PowerShell.Core FileSystem”
我为Windows安装了GitHub。如果我运行“混帐壳牌”,PowerShell的外壳打开,但它的功能安装git
和C:\Users\crclayton\Desktop\GitHub>
开始不H:\>
如果我尝试在一个正常的PowerShell来使用git
,它告诉我的git没有被识别为一个函数。但是,如果我在正常的PowerShell加载脚本C:\Users\crclayton\AppData\Local\GitHub\shell.ps1
,我可以使用git
,但是,当我浏览到该文件夹,并尝试add
或commit
或push
,我得到的错误:
git.exe : fatal: unable to access
'Microsoft.PowerShell.Core\FileSystem::\mypath../.config/git/config': Invalid argument At
C:\Users\crclayton\Desktop\autogit.ps1:7 char:4
git <<<< add *
CategoryInfo : NotSpecified: (fatal: unable t...nvalid argument: String) [], RemoteException
- FullyQualifiedErrorId : NativeCommandError
这是我的代码:
#(Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1") # tried this, doesn't work
C:\Users\crclayton\AppData\Local\GitHub\shell.ps1
$msg = Read-Host "Enter commit msg"
cd "C:\Users\crclayton\project\"
git add *
git commit -a -m $msg
git push origin master
任何人都可以看到有什么问题或建议替代?提前致谢。
谢谢!这工作,但只有当我发现'git.exe'埋在以下文件夹:'C:\ Users \ crclayton \ AppData \ Local \ GitHub \ PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad \ bin'。 – 2015-03-11 23:12:56