How to push a tag to a remote repository - git-tag

Hey please someone help me,
I am new to git.
I pull the code from repo,
and modified locally and I want to push my changes to remote repo tag
but when i tried to push
:git push origin tagname
I am getting message like "Everything up-to-date"
Please some one help me.
And i got one more doubt what is the difference between
:git push origin tagname and :git push upstream tagname
Thanks,
Raj

Use below command to push single tag
$git push <REMOTE_NAME> <TAG_NAME>
Eg:$git push origin MyTag
Use best practices like below to avoid branch name and tag name collision
$git push origin refs/tags/MyTag
Use below command to push all your tags
$git push <REMOTE_NAME> --tags

Related

Git Push Heroku Master rejected, even though everything up to date

I'm really confused -- I have made some changes to my app, and need to push the changes to heroku.
I have run git add . git commit -m "message", and git push origin master (all my work is on master branch), and get the message saying Everything up to date.
HOWEVER, when I run git push heroku master immediately after, I get a message saying Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again.
When I run git pull origin master, it says Already up-to-date. So I'm really baffled as to what is behind here, or what I need to do!
use source-tree and check the file status and then try to push.
https://www.sourcetreeapp.com/

Rails 5 - pushing to GitHub

I was pushing normally to my repository, but I had to delete that one due to mistakes I made.
Afterwards, I made a new repository and connected it, but when I try to push my whole code to that repository, it does not get pushed since I have no changes.
On branch final-branch
nothing to commit, working tree clean
If I type git add --all and push it all to a new branch, only .txt files get pushed, nothing else.
How can I push my whole code to a new repo ?
You need to add a new remote:
git remote add new-remote https://github.com/user/repo.git
To check if the add work fine:
git remote -v
You should see something like:
new-remote https://github.com/user/repo.git (fetch)
new-remote https://github.com/user/repo.git (push)
A then you can push to your new remote:
git push new-remote master

Gerrit: remote rejected (you are not allowed to upload merges) even though I allowed "Push merge commit"

I've configured Gerrit to allow Push Merge Commit on my branch, but I still get the following error when I try to push a merge commit:
! [remote rejected] ANDROID-foo -> ANDROID-foo (you are not allowed to upload merges)
I'm running Gerrit 2.8-1-gaa9367b.
This is a bug in gerrit. The workaround is to create another reference named refs/for/refs/heads/<BRANCH_NAME>, and allow Push Merge Commit on it.
To be more specifically, add following lines in your project.config file
[access "refs/for/refs/*"]
pushMerge = group <your-id-here>
Workaround which was more suitable for me as it doesn't involve knowing branches is to allow Push Merge Commit to refs/for/refs/heads/*. You probably won't want to be doing changing these for every branch specifically.
It worked for me by this way(after this link):
git stash
git pull --rebase
git push
git pull
git stash pop
First I reset the pointer to the commit of remote using soft mode, then I run
git add .
git commit --amend
git push
It works for me. :)

Trouble pushing changes to remote Git repo

I have started learning Ruby on Rails and Git.
Whenever I try to push any changes to my remote repo on Github, I encounter the following error:
C:\Sites\first>git push origin master
To git#github.com:piy9/Twitter_clone.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:piy9/Twitter_clone.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
NOte: I have added all the files in the directory and committed the changes. I have not created any separate branches using pull or checkout.
I am not asking for a solution to the problem.
doing
git push -f or
git push origin +HEAD
worked for me.
What I want to know is, why am I getting the error while trying to push to the original branch.
follow this and get everything works....
git branch production
git checkout production
#do some code changes
git commit -am "some desparate code changes to try fix heroku"
git push heroku production:master
Note: this will get your work done and will leave your previous branch.
or you can try this one also git push heroku +master
Looks like remote branch is ahead of yours, which means it contains something your local branch does not have. You may easily see commits on remote branch since when local branch was created or updated (assuming you run "git fetch origin/master" to fetch remote changes first):
git diff HEAD...origin/master
The output will answer your question why you are getting the error.
Now, my guess about the reason of the problem you have is that either someone has access to remote and pushed something, or you modified something using github editing interface and committed since last checkout/pull/merge. Using forced push as you did is not a good approach and it messes the history, it basically overwrites the remote branch with your copy, ignoring any remote changes.

How to push existing source code to a repository in github?

I have a rails app hosted on heroku and i want to push the code to github(Aready created a repo on there).I tried to follow the steps in this question .Since i already have a local repository and currently can push and pull from heroku i skipped step 2 and 3 .But when i do step 4
git remote add origin git#github.com:sparkz19/stark-journey-1727.git
It says
fatal: remote origin already exists.
And when i do git remote -v
It says
origin git#heroku.com:stark-journey-1727.git (fetch)
origin git#heroku.com:stark-journey-1727.git (push)
What do i need to do here?Thank you in advance.
Git complains because origin is already defined. If you still want to keep the heroku remote you could use git remote rename to save it as another remote:
git remote rename origin heroku
Reset the url with git remote set-url:
git remote set-url origin git#github.com:sparkz19/stark-journey-1727.git
Now you can push and pull to any you like:
git pull heroku master
git push origin master
Just give your new remote a different name than origin and you'll be good to go.

Resources