我有一個問題,我不小心將目錄複製到自己的子目錄,從而創建數千個git事務。在嘗試清理這些文件失敗後,我決定創建一個新項目並從舊文件複製文件。不知何故,我認爲我搞砸了,但我不知道問題出在哪裏。這是我目前的症狀。卡在git循環
我以爲我正確地初始化了git存儲庫。但是,github上沒有任何文件。
https://github.com/victorengel/matchismo2
...除了我創建了那裏。
該項目本身是一個iOS單視圖應用程序,我創建了啓用git。我將舊項目所需的所有文件複製到新項目區域,確認它已運行,然後嘗試提交。承諾似乎工作,但推動沒有。
如果我嘗試了一次推送,我收到一條消息,說明工作副本已過期,我應該進行一次拉取。如果我嘗試了拉,它說有未經承諾的變化,我應該放棄它們或承諾。經過一番周折之後,我發現引發這種變化的變化是在.gitignore中應該忽略的用戶數據變化。
我終於有了.gitignore設置它需要的方式。我認爲知識庫是在github.com上設置的,但我仍然遇到錯誤。
我可以承諾但不推動。如果我嘗試推送,我會收到消息「工作副本已過期,請嘗試從遠程獲取最新更改,然後再次按下。」
如果我嘗試拉,我得到消息「matchismo2/master」不是一個有效的遠程分支拉。請選擇一個不同的遠程分支。
環顧github.com,只有一個分支,master在victorengel/matchismo2下。對我來說,它看起來像一切正常,但顯然我錯過了一些東西。它是什麼?
在Xcode中,在組織器中,如果我點擊分支,則列出一個項目:master。 如果我點擊遙控器,有一個項目,matchismo2,如果我擴大它,主人列出。
我一直假設這個matchismo2與它下面的主人是什麼應該匹配錯誤消息中的「matchismo2 /主」。看起來像一場比賽,所以爲什麼它不工作?
編輯: 如果我嘗試從GitHub應用程序中提取,我收到一條錯誤消息「服務器上沒有任何遠程分支。」如果我嘗試從GitHub出版,我得到如下:
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
2013-03-05 16:32:43.680 GitHub for Mac Login[68518:707] AskPass with arguments: (
"/Users/brillig/Downloads/GitHub.app/Contents/MacOS/GitHub for Mac Login",
"Password for 'https://[email protected]': "
)
2013-03-05 16:32:43.763 GitHub for Mac Login[68518:707] Error reading attributes: OSStatus -2033889429
2013-03-05 16:32:43.764 GitHub for Mac Login[68518:707] Error reading attributes: OSStatus -2033889429
2013-03-05 16:32:43.919 GitHub for Mac Login[68518:707] Error reading attributes for password: OSStatus 840183217
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
To https://[email protected]/victorengel/matchismo2.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://[email protected]/victorengel/matchismo2.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
(256)
當您複製文件時,您偶然意外複製了.git目錄嗎? – 2013-03-05 20:45:04
不,我按類別複製了我需要的文件(圖像,模型文件,視圖文件,控制器文件,故事板文件),這是不可能的。 – 2013-03-05 20:48:18
你是否知道'.gitignore'只會影響'git status'和'git add'的默認值?一旦文件被git追蹤,git的知識將取代任何'.gitignore'規則。例如,忽略* all *文件並不罕見,然後'git只添加您想要追蹤的文件。 – 2013-03-05 20:53:32