git push not send changes to remote git repository

2019-01-16 23:48发布

I am making changes to some file in my local git repository and then want to send the changes to the remote git repository from which the local was cloned via ssh.

After run "git commit -a" on my local side, to send the changes to the remote, I run

$ git push
Everything up-to-date

However I checked the remote files and they are not changed! Any idea?

Thanks and regards!

标签: git push
10条回答
Lonely孤独者°
2楼-- · 2019-01-17 00:07
git commit --amend

Will change the commit ID and make the remote repository "think" new changes has been made.

查看更多
男人必须洒脱
3楼-- · 2019-01-17 00:08

I found that the issue was that I had not added the files to the update as well as a message. I fixed this by using the following commands:

git add .

and then

git commit -m "updates done by..."

and then

git push origin <repo_name>

Hope this helps someone ;)

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-01-17 00:09

None of these solutions worked for me, and the commits would appear on my live website only after running GIT_WORK_TREE=/path/to/website git checkout -f. If this is your case you have to add a "hook" to your git configuration.

  1. Go to your the hooks folder inside your git folder:

    cd ~/path/.git

    cd hooks

    nano post-receive

  2. Write this line in the post-receive file:

    GIT_WORK_TREE=/path/to/your/website/or/project/ git checkout -f

  3. Lastly, you have to modify the permissions of the post-receive file:

    chmod a+x post-receive

This will execute that command every time you push, updating your commits on your remote project.

查看更多
做个烂人
5楼-- · 2019-01-17 00:12

type "git log" in your remote repository to see if it contains the newest commit. If not, you should check the configuration of you local repository to see the remote settings.

To see the changes in different type of your remote repository:

A. If your remote repository is bare, you can find the files in the remote repository branches/ config description HEAD hooks/ info/ objects/ refs/

after new commit is pushed, files in objects/ directory would changed.

B. If your remote repository is non-bare, type "git checkout master" And "git status" in your remote repository to see the file status. See if some file has been modified or deleted.

查看更多
登录 后发表回答