2014-12-07 63 views
1

我這個「gittify.cmd」批處理文件,在我的工作目錄:.CMD批處理文件不推我的本地git的回購協議的GitHub

git status 
git add --all 
git status 
set /p commitComment=Enter the Commit Comment:%=% 
@echo git commit -m "%commitComment%" 
git status 
git push origin master 

的問題是,它不是推的變化GitHub上。 ..但如果我通過命令手動輸入,它的工作沒有問題。

這是經過「混帳推起源大師」最後的命令:

C:\www\lantosistvan.com>git push origin master 
github --credentials get: github: command not found 
Username for 'https://github.com': <My username> 
Password for 'https://<My username>@github.com': 
github --credentials store: github: command not found 
Everything up-to-date 

在此之後,我需要從本地git的刪除與此命令的特定文件:

git reset HEAD <stucked file> 

更新1:

這是我的路徑:

C:\Users\<My username>\AppData\Local\GitHub\PortableGit_<code>\bin 

我可以在cmd和ConEmu中運行git沒有問題。

git config --global credential.helper 

沒有顯示任何東西。

當我推送到GitHub時,我不使用SSH。我總是輸入我的用戶名和密碼。

更新2:

在我的電腦不同,GitHub和Git的Bash安裝在同一時間。 PATH只針對AppData下的GitHub文件夾。

更新3 - 解決方案:

出於某種原因,@echo造成的錯誤。它只是簡單的阻止提交。所以在git push origin master之前,我的工作目錄並不乾淨。刪除@echo解決了這個問題:

git status 
git add --all 
git status 
set /p commitComment=Enter the Commit Comment:%=% 
git commit -m "%commitComment%" 
git status 
git push origin master 
+0

我建議使用git-gui或GitExtensions作爲提交工具,並且實際檢查您將要提交的內容,以避免意外地提交遺留下來的垃圾文件和您不想包含的文件。我也建議不要推動每一個提交。相反,一旦任務完成就推送。任務可能需要一些獨立的工作單元,這些工作單元應該是單獨的提交。 – patthoyts 2014-12-11 20:24:20

+0

我已經排除了node_modules文件夾和其他一些我不需要在.gitignore文件中推送的文件。感謝這些信息,我會照顧一個Sublime Text或Gulp的插件,它只是立即推送一個修改過的文件。 – Lanti 2014-12-11 20:38:16

回答

0

它看起來像你有一個憑證幫手配置的Git,而且似乎與調用它在本地的一個問題。

你能做到以下幾點:檢查該證書助手通過運行

git config --global credential.helper 

這應該打印憑證的輔助可執行文件的名稱和路徑安裝。驗證此文件是否已在本地安裝幷包含在shell的路徑中。

從消息看,它看起來像github可執行文件不在您的PATH上。嘗試解決該問題,然後再次運行該批處理文件。

+0

我更新了我的問題。 – Lanti 2014-12-08 17:16:12

相關問題