我對git相對陌生,想要測試它。我的webhosting允許通過SSH的GIT,我發現一些教程,但現在我卡住了。對不起,如果我的問題聽起來很愚蠢。Git Push - 不工作
我所做的:
登錄到我通過SSH遠程主機商和初始化一個新的Git項目:
git init git add . git commit -m 'version 1.0.0'
這輸出了我一個很長的文件列表,即已更新。
我克隆我的本地計算機上的存儲庫,並創建新文件「index2.php」
git clone XXX.git cp index.php index2.php git add index2.php git commit -m "Index2.php added"
然後我試圖推新「索引2。 PHP「文件到我的服務器上。得到一個錯誤,所以我不得不到遠程服務器
git config receive.denyCurrentBranch ignore
git push origin master Counting objects: 2, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 231 bytes | 0 bytes/s, done. Total 2 (delta 1), reused 0 (delta 0) To ssh://XXX.git 1b79ddf..1cfe422 master -> master
上設置好像文件已被按下。但是當我在遠程服務器上執行ls -l時,新文件「index2.php」不存在。爲什麼?我忘了什麼嗎?
UPDATE: 當我做我的遠程服務器上的git的狀態,我得到如下:
git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: index2.php
這是什麼意思?
git log命令在遠程服務器上顯示的是什麼?它顯示提交「Index2.php添加」? – yaswanth
這是日誌的輸出:提交1b79ddf432ea910056c5b4be7e8a637dd4ef1124 著者:丹尼爾Barenkamp <[email protected]> 日期:星期三07月26 9時42分53秒2017 0200 索引2加入 –
_「得到了一個錯誤,從而我不得不在遠程服務器上設置git config receive.denyCurrentBranch忽略「_ - 你應該停在那裏,因爲你正在做一些你不應該做的事情。你應該在服務器上創建一個裸存儲庫,並且只能在那裏推送。 – 1615903