Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push not send changes to remote git repository

Tags:

git

push

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!

like image 957
Tim Avatar asked Aug 19 '09 08:08

Tim


People also ask

How do I push changes to my remote repository?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.

Why is my git push not updating?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

Does git push send tags to remote?

Sharing TagsBy default, the git push command doesn't transfer tags to remote servers. You will have to explicitly push tags to a shared server after you have created them. This process is just like sharing remote branches — you can run git push origin <tagname> .


4 Answers

Have you tried the following?

 $ git push origin master:master

Use git remote to find out the name(s) of your remote(s). The default remote is origin, which is automatically created when cloning a repository.

like image 112
knittl Avatar answered Oct 14 '22 02:10

knittl


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 ;)

like image 43
Herbert Avatar answered Oct 14 '22 01:10

Herbert


You probably pushed into a non-bare repository, i.e. a repository that has a working copy attached to it. You shouldn’t have ignored the warning git push gives you if it notices that this is the case.

Anyway, log in to the remote machine, change to the repository and do

git checkout <whatever branch you’re on>

There you go. Next time only push into bare repositories. :)

like image 22
Bombe Avatar answered Oct 14 '22 03:10

Bombe


I had the same issue and it was because I had checked out to a point in the history (in this case a tag), rather than the end (head) of any branch or master. I would make the change and commit which would succeed and I would see the changes in my local history. When I ran git push, git stated everything was fine, but the change had not actually been submitted to the server (which can be seen by checking the logs, or by re-cloning the repo and checking it's logs). The best symptom of this mistake is seeing the message "Head detatched from ____"

The Solution

What one actually needs to do (if you have done what I've done) is create a new line of development by creating a branch and switching to that branch before making the changes.

git branch [a new branch name]
git checkout [a new branch name]  

Then after committing the changes, if you want the changes to be pushed to the server you need to push the branch itself to the server.

git push -u origin [local branch name]

Now if you clone the repository, you should see your changes in the logs. However, next time you clone the repository, to be able to go to that point you just changed, you will need to checkout that branch, as you will default to being on the main line which is "further" down the development line from where you branched off.

git checkout [branch name]  
like image 9
Programster Avatar answered Oct 14 '22 02:10

Programster