1th question: Resolve git code warehouse not synchronized
Today when you execute git pull:
[root@gitserver/data/work/www/rest/lib/business/inventory]# git pull Enter passphrase for key '/root/.ssh/id_rsa ': Up Dating 70e8b93. a0f1a6c Error:your Local changes to the following files would is overwritten by Merge:rest/lib/business/inve ntory/productstatus.php, commit your changes or stash them before you can merge. Aborting
Workaround:
Execute git checkout-f and then execute git pull re checkout
[root@gitserver/data/work/www/rest/lib/business/inventory]# git checkout-f Your branch is behind ' Origin/master ' by 2 Commits, and can be fast-forwarded.
You can do this again when you're done with git pull:
[root@gitserver/data/work/www/rest/lib/business/inventory]# git pull Enter passphrase for key '/root/.ssh/id_rsa ': Up Dating 70e8b93. A0F1A6C Fast-forward rest/lib/business/inventory/productstatus.php | 1 + 1 files changed, 1 insertions (+), 0 deletions (-) mode change 100644 => 100755 Rest/lib/business/inventory/pro ductstatus.php
2nd question: The default address problem for git pull.
1.git is in master this branch, the default remote is origin;
2. Use the default remote and merge when using the named Git pull for remote and merge under Master this Brach.
But for their own projects, and push to the remote server, and do not have this piece of content, need to configure themselves.
If you run git pull directly, you get this result:
#当执行git pull after the message:
$ git pull Password: you asked me to pull without telling me which branch you want to merge with, and ' Branch.master.merge ' in your configuration file does not tell me, either. please Specify which branch you want to use on the command line and try again (e.g. ' git pull < Repository> <refspec> '). See git-pull (1) for details. if you often merge with the same branch, you may want to use something like the following in your Configuration file: [branch "master" remote = <nickname > merge = <remote-ref>   [remote "<nickname>" url = <url> fetch = <refspec> see git-config (1) for details.
#解决方法, use git config to configure the following.
git remote add-f origin git@192.168.21.44:rest.git git config branch.master.remote origin git config branch.master.me Rge Refs/heads/master This article is reproduced from: http://ritto.blog.51cto.com/427838/741342