Editing Git push

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 11: Line 11:
  
 
== Basic commands ==
 
== Basic commands ==
* <code>[[git push]] ([[git push --help|--help]])</code>
+
* <code>[[git push]]</code>
 
* <code>[[git push -v]]</code>
 
* <code>[[git push -v]]</code>
 
* <code>[[GIT_SSH_COMMAND]]="ssh -v" [[GIT_TRACE]]=1 git push -vvv -u origin main</code>
 
* <code>[[GIT_SSH_COMMAND]]="ssh -v" [[GIT_TRACE]]=1 git push -vvv -u origin main</code>
Line 24: Line 24:
 
* <code> git push -u origin master or [[git push --set-upstream origin master]] (Used by argument-less <code>[[git pull]]</code>)</code>
 
* <code> git push -u origin master or [[git push --set-upstream origin master]] (Used by argument-less <code>[[git pull]]</code>)</code>
 
* <code>[[git push origin]] HEAD:master</code>
 
* <code>[[git push origin]] HEAD:master</code>
* <code>[[git push --tags]]</code>
 
* <code>[[git push --set-upstream]]</code>
 
  
 
== Additional commands ==
 
== Additional commands ==
[[How to skip a pipeline]]
+
How to [[skip]] a [[pipeline]]
 
* <code>[[git push -o ci.skip]]</code>
 
* <code>[[git push -o ci.skip]]</code>
  
 
== Examples ==
 
== Examples ==
 
  <code>[[git]] push</code>
 
  <code>[[git]] push</code>
  <code>[[Everything up-to-date]]</code>
+
  <code>Everything up-to-date</code>
  
  [[git push -u]] origin master
+
 
 +
  git push -u origin master
 
    
 
    
 
  Enumerating objects: 3, done.
 
  Enumerating objects: 3, done.
Line 44: Line 43:
 
  * [new branch]      master -> master
 
  * [new branch]      master -> master
 
  Branch 'master' set up to track remote branch 'master' from 'origin'.
 
  Branch 'master' set up to track remote branch 'master' from 'origin'.
 
git push xxx your-branch
 
To https://github.com/your-user/your-repo.git
 
  ! [rejected]        your-branch -> your-branch ([[non-fast-forward]])
 
error: failed to push some refs to 'https://github.com/your-user/your-repo.git'
 
hint: Updates were rejected because a pushed branch tip is behind its remote
 
hint: counterpart. Check out this branch and integrate the remote changes
 
hint: (e.g. 'git pull ...') before pushing again.
 
hint: See the 'Note about fast-forwards' in '[[git push --help]]' for details.
 
  
 
== git push with errors ==
 
== git push with errors ==
Line 84: Line 74:
 
     git push <name>
 
     git push <name>
  
=== [[No upstream branch]] ===
+
=== No upstream branch ===
 
  git push
 
  git push
  fatal: The current branch YOUR_BRANCH has no upstream branch.
+
  fatal: The current branch master has no upstream branch.
 
  To push the current branch and set the remote as upstream, use
 
  To push the current branch and set the remote as upstream, use
 
   
 
   
     [[git push --set-upstream origin YOUR_BRANCH]]
+
     [[git push --set-upstream origin master]]
  
=== [[error: src refspec master does not match any]] ===
+
error: src refspec master does not match any
  
* [[You are not allowed to force push code to a protected branch]]
+
=== [[You are not allowed to force push code to a protected branch]] ===
* [[fatal: You are not currently on a branch]]
 
  
 
== Example with all steps ==
 
== Example with all steps ==
 
  [[touch]] README.md
 
  [[touch]] README.md
 
  [[git add]] README.md
 
  [[git add]] README.md
  [[git commit -m]] "add README"
+
  [[git commit]] -m "add README"
 
  git push -u origin master
 
  git push -u origin master
  
Line 109: Line 98:
 
* <code>[[git push --follow-tags]]</code>
 
* <code>[[git push --follow-tags]]</code>
 
* <code>[[git config]]</code>
 
* <code>[[git config]]</code>
* <code>[[git push -o]] [[merge_request]].create</code>
+
* <code>git push -o [[merge_request]].create</code>
 
* <code>[[git merge]]</code>
 
* <code>[[git merge]]</code>
 
* <code>[[git commit]]</code>, <code>[[git commit -an]]</code>
 
* <code>[[git commit]]</code>, <code>[[git commit -an]]</code>
Line 116: Line 105:
 
* <code>[[git remote add]]</code>
 
* <code>[[git remote add]]</code>
 
* <code>[[git config --global --edit]]</code>
 
* <code>[[git config --global --edit]]</code>
* <code>[[helm push]]</code>
 
  
 
== See also ==
 
== See also ==
 
* {{git push}}
 
* {{git push}}
 +
* {{git}}
  
 
[[Category:Git]]
 
[[Category:Git]]

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Templates used on this page:

Advertising: