Method B : git clone –bare
Method A :
git clone –mirror to local
Go to another folder, git clone form local repository.
git push to local repository.
Go to local repository then type git push to push the commit to remote.
[core]
repositoryformatversion = 0
filemode = true
bare = true
[remote "origin"]
url = ssh://happy@168.95.1.1/home/happy/git/test
fetch = +refs/*:refs/*
mirror = true
Method B :
git clone –bare to local
Go to another folder, git clone form local repository.
git push to local repository.
Go to local repository then type git push to push the commit to remote.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ssh://happy@168.95.1.1/home/happy/git/test
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Compare :
method A
When I git push under method A. git push no ask any question.
method B
When I git push under method B. git push ask question and type following command at the first push.
git push –set-upstream origin master
After push you can find log have keywork "merge". Because git clone --bare clone the repository to become a independent one. So even remote and local repository are the same content. When push from local to remote need to merge together. But mirror don't need.
That is the different.
Reference:
- Duplicating a repository
0 意見:
張貼留言