Difference between revisions of "Git push"

From wikieduonline
Jump to navigation Jump to search
 
(71 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
<code>[[git push]]</code> update remote refs along with associated objects
+
<code>[[git push]]</code> update/upload remote refs along with associated objects
 
* https://git-scm.com/docs/git-push
 
* https://git-scm.com/docs/git-push
  
git push
 
Everything up-to-date
 
  
[[git push -v]]
+
* Steps: <code>[[git add]]</code> -> <code>[[git commit]]</code> -> <code>[[git push]]</code>
 +
* [[How to commit to remote branch]]
 +
* [[Make Local Changes and Update remote Repositories]]
 +
 
  
git push -v -u [[origin]] [[main]]
 
  
git push -u [[origin]] [[main]]
+
== Basic commands ==
git push -u origin master
+
* <code>[[git push]] ([[git push --help|--help]])</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]]=2 git push -vvv -u origin main</code>
 +
* <code>git push -v -u [[origin]] [[main]]</code>
 +
* <code>git push -v --force -u [[origin]] [[main]]</code>
 +
* <code>[[git push -f origin master]]</code>
 +
* <code>[[git push -u origin main]]</code>
 +
* <code>[[git push -uf]]</code>
 +
* <code>[[git push origin master]]</code>
 +
* <code>[[git push -u origin master]]</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 --tags]]</code>
 +
* <code>[[git push --set-upstream]]</code>
  
git push origin master
+
== Additional commands ==
Enumerating objects: 3, done.
+
[[How to skip a pipeline]]
Counting objects: 100% (3/3), done.
+
* <code>[[git push -o ci.skip]]</code>
Writing objects: 100% (3/3), 245 bytes | 245.00 KiB/s, done.
 
Total 3 (delta 0), reused 0 (delta 0)
 
To ssh://gitlab.yourdomain.com:2224/project/project_test.git
 
* [new branch]     master -> master
 
  
 +
== Examples ==
 +
<code>[[git]] push</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 32: Line 45:
 
  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 -u origin master or git push --set-upstream origin master (Used by argument-less <code>[[git pull]]</code>)
 
 
 
=== Git push with errors ==
 
 
  git push -u origin master
 
  git push -u origin master
 
  ssh_exchange_identification: read: Operation timed out
 
  ssh_exchange_identification: read: Operation timed out
Line 45: Line 62:
 
  and the repository exists.
 
  and the repository exists.
  
 +
=== [rejected] ===
 +
[[git]] push
 +
To github.com:user/proyect.git
 +
! [rejected]        master -> master (fetch first)
 +
error: failed to push some refs to 'github.com:user/proyect.git'
 +
hint: Updates were rejected because the remote contains work that you do
 +
hint: not have locally. This is usually caused by another repository pushing
 +
hint: to the same ref. You may want to first 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.
 +
 +
=== No configured push destination ===
 
  git push
 
  git push
 
  fatal: No configured push destination.
 
  fatal: No configured push destination.
Line 55: Line 84:
 
     git push <name>
 
     git push <name>
  
 +
=== [[No upstream branch]] ===
 
  git push
 
  git push
  fatal: The current branch master has no upstream branch.
+
  fatal: The current branch YOUR_BRANCH 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 master]]
+
     [[git push --set-upstream origin YOUR_BRANCH]]
 +
 
 +
=== [[error: src refspec master does not match any]] ===
  
 +
* [[You are not allowed to force push code to a protected branch]]
 +
* [[fatal: You are not currently on a branch]]
 +
* [[remote: Permission to]] ...
  
== Example ==
+
== 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
  
 +
== Activities ==
 +
* [[How to commit to remote branch]]: <code>[[git push origin]]</code>
  
 
== Related terms ==
 
== Related terms ==
Line 73: Line 110:
 
* <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]]</code>, <code>[[git commit -an]]</code>
 
* <code>[[conan upload]]</code>
 
* <code>[[conan upload]]</code>
 
* <code>[[docker push]]</code>
 
* <code>[[docker push]]</code>
 
* <code>[[git remote add]]</code>
 
* <code>[[git remote add]]</code>
 
+
* <code>[[git config --global --edit]]</code>
 
+
* <code>[[helm push]]</code>
error: src refspec master does not match any
+
* [[Denied to lorks]]
 +
* [[remote: Support for password authentication was removed on August 13, 2021.]]
  
 
== See also ==
 
== See also ==
* {{git}}
+
* {{git push}}
  
 
[[Category:Git]]
 
[[Category:Git]]

Latest revision as of 07:04, 17 July 2024

git push update/upload remote refs along with associated objects



Basic commands[edit]

Additional commands[edit]

How to skip a pipeline

Examples[edit]

git push
Everything up-to-date
git push -u origin master
 
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 212 bytes | 212.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To ssh://gitlab.yourdomain.com:2224/project/project_test.git
* [new branch]      master -> master
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[edit]

git push -u origin master
ssh_exchange_identification: read: Operation timed out
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights
and the repository exists.

[rejected][edit]

git push
To github.com:user/proyect.git
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'github.com:user/proyect.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first 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.

No configured push destination[edit]

git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url> 

and then push using the remote name 

    git push <name>

No upstream branch[edit]

git push
fatal: The current branch YOUR_BRANCH has no upstream branch.
To push the current branch and set the remote as upstream, use

   git push --set-upstream origin YOUR_BRANCH

error: src refspec master does not match any[edit]

Example with all steps[edit]

touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Activities[edit]

Related terms[edit]

See also[edit]

Advertising: