简体   繁体   English

Git没有在存储库中提取文件

[英]Git not pulling files in the repository

I have a git repository in the server, I have to push and pull my data into it. 我在服务器中有一个git存储库,我必须将数据推入并拉入其中。 When i tried to pull on one instance a lot of my files got deleted even though it is present in the repository. 当我试图拉一个实例时,我的很多文件都被删除了,即使它存在于存储库中。 The commands I have used are given below 我使用的命令如下

git add .
git add -u
git commit -m 'comments'
git pull origin master

This is what happens in the terminal on running these commands 这是终端在运行这些命令时发生的情况

manesh@sysadmin-PC:/var/www/MobpazAdmin$ git add .
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git add -u
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git commit -m 'with add ads'
[master 5706969] with add ads
Committer: Manesh <manesh@sysadmin-PC.(none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

git config --global user.name "Your Name"
git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

git commit --amend --reset-author

10 files changed, 523 insertions(+), 5 deletions(-)
create mode 100755 src/Mobpaz/AdminBundle/Controller/AdsController.php
create mode 100644 src/Mobpaz/AdminBundle/Entity/Ads.php
create mode 100644 src/Mobpaz/AdminBundle/Entity/AdsRepository.php
create mode 100644          src/Mobpaz/AdminBundle/Resources/config/doctrine/metadata/orm/Ads.orm.xml
create mode 100755 src/Mobpaz/AdminBundle/Resources/views/Ads/addads.html.twig
create mode 100755 src/Mobpaz/AdminBundle/Resources/views/Ads/index.html.twig
mode change 100644 => 100755 src/Mobpaz/AdminBundle/Resources/views/Logs/index.html.twig
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git pull origin master
git@192.168.10.241's password: 
remote: Counting objects: 50, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 28 (delta 14), reused 0 (delta 0)
Unpacking objects: 100% (28/28), done.
From 192.168.10.241:/var/www/repositories/Mobpaz/MobpazAdmin
* branch            master     -> FETCH_HEAD  
Auto-merging src/Mobpaz/AdminBundle/Resources/views/base.html.twig
Auto-merging src/Mobpaz/AdminBundle/Resources/views/Logs/index.html.twig
Auto-merging src/Mobpaz/AdminBundle/Resources/config/routing.yml
CONFLICT (content): Merge conflict in   src/Mobpaz/AdminBundle/Resources/config/routing.yml
Automatic merge failed; fix conflicts and then commit the result.
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git add .
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git add -u
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git commit -m 'with add ads'
[master 0c0e548] with add ads
Committer: Manesh <manesh@sysadmin-PC.(none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

git config --global user.name "Your Name"
git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

git commit --amend --reset-author

manesh@sysadmin-PC:/var/www/MobpazAdmin$ git commit -m 'with add ads'
# On branch master
nothing to commit (working directory clean)
manesh@sysadmin-PC:/var/www/MobpazAdmin$ git pull origin master
git@192.168.10.241's password: 
From 192.168.10.241:/var/www/repositories/Mobpaz/MobpazAdmin
* branch            master     -> FETCH_HEAD
Already up-to-date.

I resolved the conflict that occurred in the first pull before doing the second. 我解决了在第二次拉动之前发生的冲突。 Please tell me what I'm doing wrong this happens often hence my work is getting interrupted after every push and pull. 请告诉我,我做错了这种情况经常发生,因此我的工作在每次推拉后都会中断。

My issue is that even the files that is there in the repository is deleted from my local copy. 我的问题是,即使存储库中的文件也会从我的本地副本中删除。

I think you are mistaking what commit does compared to push . 我认为你错误地认为commitpush相比。

commit creates a local staging area for you to work with. commit创建一个本地暂存区域供您使用。 This is completely local, and your git server has no notion of these changes. 这是完全本地的,您的git服务器没有这些更改的概念。

When you push your changes (after commit ting), your server will then hold your changes. 当您push更改时( commit后),您的服务器将保留您的更改。

Sorry if I am incorrect here, your logs just don't have any push calls. 对不起,如果我在这里不正确,你的日志就没有任何push电话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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