Common problems and solutions when git pull __github

Source: Internet
Author: User

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> &nbsp     [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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.