2012-06-04 76 views
2

當我做git push時,如果需要,git會自動執行強制更新,就像我指定了--force選項一樣。我很久以前就已經配置好了。我不再需要這種行爲,並且找不到影響此行爲的配置變量。我找不到.gitconfig.git/config文件中的任何相關內容。默認情況下git push --force

編輯:加入我的當前配置文件:

我的.gitconfig:

[user] 
    name = xxxx xxxx 
    email = xxxx 
[core] 
    excludesfile = /Users/xxxx/.gitignore_global 
[difftool "sourcetree"] 
    cmd = opendiff \"$LOCAL\" \"$REMOTE\" 
    path = 
[mergetool "sourcetree"] 
    cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" 
    trustExitCode = true 

本地回購的配置:

[core] 
    repositoryformatversion = 0 
    filemode = true 
    bare = false 
    logallrefupdates = true 
    ignorecase = true 
[remote "origin"] 
    url = ssh://[email protected]/var/git/tw 
    fetch = +refs/heads/*:refs/remotes/origin/* 
    push = +refs/heads/*:refs/heads/* 
[remote "AudioCopy"] 
    url = /Users/xxxx/Src/AudioCopy/myacp 
    fetch = +refs/heads/*:refs/remotes/AudioCopy/* 
[submodule "Sources/iPhoneInterface/SoundCloud/CocoaSoundCloudAPI"] 
    url = git://github.com/soundcloud/CocoaSoundCloudAPI.git 
[submodule "Sources/iPhoneInterface/SoundCloud/CocoaSoundCloudUI"] 
    url = git://github.com/soundcloud/CocoaSoundCloudUI.git 
[submodule "Sources/iPhoneInterface/SoundCloud/JSONKit"] 
    url = git://github.com/nxtbgthng/JSONKit.git 
[submodule "Sources/iPhoneInterface/SoundCloud/OAuth2Client"] 
    url = git://github.com/nxtbgthng/OAuth2Client.git 
[submodule "Sources/iPhoneInterface/SoundCloud/OHAttributedLabel"] 
    url = git://github.com/nxtbgthng/OHAttributedLabel.git 
[branch "linux"] 
    remote = origin 
    merge = refs/heads/linux 

遠程回購的配置:

[core] 
    repositoryformatversion = 0 
    filemode = true 
    bare = true 

樣本運行:

~/Src/tw % git push 
Counting objects: 7, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (3/3), done. 
Writing objects: 100% (3/3), 394 bytes, done. 
Total 3 (delta 2), reused 0 (delta 0) 
To ssh://[email protected]/var/git/tw 
    26636fd..4247b2e guile20 -> guile20 
+ e80b72f...3578ee1 linux -> linux (forced update) 
~/Src/tw % 

回答

5

從你[remote "origin"] config條目看起來你已經設置了一個鏡像推。如果這不是你想要的,我會完全擺脫這條線。如果您對鏡像樣式推送感到滿意但不想強制執行(這對我來說沒有多大意義),您想從本地存儲庫配置的[remote "origin"]部分的推送行中刪除前綴+

或者:

git config --unset remote.origin.push 

或:

git config remote.origin.push 'refs/heads/*:refs/heads/*' 

,這取決於你的選擇做出。

+0

就是這樣。非常感謝。我會考慮不同的選擇。 – Thomas