Questions tagged [git-push]

Pushes the changes from a local Git repo to remote

git push is used to push the data and branch changes from your local Git repository to remote.

Popular questions

See also

References

$ git push --help
1705 questions
576
votes
16 answers

Fix GitLab error: "you are not allowed to push code to protected branches on this project"?

I have a problem when I push my code to git while I have developer access in my project, but everything is okay when I have master access. Where is the problem come from? And how to fix it? Error message: error: You are not allowed to push code to…
565
votes
7 answers

How do I push a local Git branch to master branch in the remote?

I have a branch called develop in my local repo, and I want to make sure that when I push it to origin it's merged with the origin/master. Currently, when I push it's added to a remote develop branch. How can I do this?
picardo
  • 24,530
  • 33
  • 104
  • 151
543
votes
6 answers

When doing a 'git push', what does '--set-upstream' do?

What does git --set-upstream do? I tried to understand it by reading the git manual, but I didn't quite get it.
474
votes
12 answers

How to push different local Git branches to Heroku/master

Heroku has a policy of ignoring all branches but 'master'. While I'm sure Heroku's designers have excellent reasons for this policy (I'm guessing for storage and performance optimization), the consequence to me as a developer is that whatever local…
Lawrence I. Siden
  • 9,191
  • 10
  • 43
  • 56
473
votes
27 answers

Can't push to GitHub because of large file which I already deleted

Currently I have Empty GitHub repo SSH server repo (main) Local Repo SSH server repo was the most up-to-date repo (production site) so I did a Git clone from there to local. I then tried to do a git push to GitHub. Everything went OK but then it…
DevKev
  • 5,714
  • 6
  • 24
  • 29
449
votes
9 answers

How do I fix "remote: fatal error in commit_refs" errors trying to push with Git?

When I try to push to master branch that is hosted on https://github.com I get: remote: fatal error in commit_refs How can I solve this?
Tomas Skogberg
  • 2,619
  • 3
  • 11
  • 10
408
votes
20 answers

How do I avoid the specification of the username and password at every git push?

I git push my work to a remote Git repository. Every push will prompt me to input username and password. I would like to avoid it for every push, but how to configure to avoid it?
Leem.fin
  • 40,781
  • 83
  • 202
  • 354
397
votes
7 answers

Meaning of the GitHub message: push declined due to email privacy restrictions

I have accepted and merged a pull request on GitHub, and now I cannot pull my commits any more. The message is: ! [remote rejected] master -> master (push declined due to email privacy restrictions) error: failed to push some refs to…
Franck Freiburger
  • 26,310
  • 20
  • 70
  • 95
345
votes
14 answers

Changing the Git remote 'push to' default

I want to change the Git default remote branch destination so I could just git push Instead of: git push upstream Currently this is set to the origin remote and I want to set it to a different remote. I tried to remove the original (cloned from)…
alonisser
  • 11,542
  • 21
  • 85
  • 139
323
votes
4 answers

Git - What is the difference between push.default "matching" and "simple"

I have been using git for a while now, but I have never had to set up a new remote repo myself and I have been curious on doing so. I have been reading tutorials and I am confused on how to get "git push" to work. If I simply use git push it asks…
Josh
  • 3,673
  • 3
  • 20
  • 27
312
votes
8 answers

How can I undo a `git commit` locally and on a remote after `git push`

I have performed git commit followed by a git push. How can I revert that change on both local and remote repositories? $ git log commit 364705c23011b0fc6a7ca2d80c86cef4a7c4db7ac8 Author: Michael Silver Date: Tue Jun 11…
michael
  • 106,540
  • 116
  • 246
  • 346
284
votes
5 answers

What does "Auto packing the repository for optimum performance" mean?

I'm having a problem with my git repo. For the last couple of days whenever I do a push to the server I get this message: "Auto packing the repository for optimum performance", and it does not seem to go away and return the shell. I also tried…
Furqan Asghar
  • 3,670
  • 4
  • 23
  • 27
282
votes
10 answers

How can I push a local Git branch to a remote with a different name easily?

I've been wondering if there's an easy way to push and pull a local branch with a remote branch with a different name without always specifying both names. For example: $ git clone myrepo.git $ git checkout -b newb $ ... $ git commit -m "Some…
jmacdonagh
  • 3,851
  • 3
  • 18
  • 14
281
votes
6 answers

How do you push just a single Git branch (and no other branches)?

I am working on a local git repository. There are two branches, master and feature_x. I want to push feature_x to the remote repo, but I do not want to push the changes on the master branch. Will a git push origin feature_x from my feature_x branch…
Rafael Mueller
  • 6,028
  • 3
  • 24
  • 28
270
votes
17 answers

Git push error: Unable to unlink old (Permission denied)

In the remote server I have a post-receive hook set up in order to make a git checkout of my repository: #!/bin/sh GIT_WORK_TREE=/var/www/ git checkout -f But when I make a push from my local machine to the git repository in the server, I…
rfc1484
  • 9,441
  • 16
  • 72
  • 123