简体   繁体   中英

git pull files from a bare repo

I have a bare repository in my remote server. Files get uploaded on the remote server, now I would like to sync or pull those uploaded files to my local repository.

I usually run git push website in order to deploy my local committed files, now I would like to do the opposite. How can I do this?

Thanks

您可以通过运行git pull GIT_SOURCE来做到这一点,其中GIT_SOURCE的格式为git@github.com:facebook / credits-api-sample.git

If I understand this, then what you're trying to do isn't possible. A bare repo is characterized by not having a working copy in the file system. Therefore no file on the disk of a bare repo can be part of the repo, and you can't pull it as a result. If it were a non-bare repo and files were uploaded into the directory where the working copy is checked out, you'd still have to add and commit the file(s) there before you'd be able to pull them from somewhere else.

Use git pull ( manpage ).

$ git pull REPO_URL

What $REPO_URL is depends on your setup. Maybe

$ git remote show website

will give you a clue.

what you have to do is a pull of you bare repository, here is an example

at your website host you have two repositories

  • repository_bare.git (bare repository)
  • repository_webapp (non-bare repository)

at your local copy - local_repository

1) you push at your local_repository and upload the modifications at your repository_bare.git 2) you pull the repository_bare.git from local_repository

git pull repository_bare.git

This will merge the modifications from your bare to your local repository

Here is a link with more information http://book.git-scm.com/3_distributed_workflows.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM