Trialcoder
Trialcoder

Reputation: 6004

How to push update to a branch in github

Let me know what I am doing wrong here ?

When I am doing $git status it is showing my branch as * my_branch

Now I changed in few files and trying to push updates to the branch so I tried two things -

1) First try

$ git add .

$ git push origin my_branch

This is showing Everything up-to-date

2) Second try

$ git add .

git commit -m "first commit"

Now on running this I am getting following error -

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'trialcoder@sysuser.(none)')

Upvotes: 0

Views: 1664

Answers (1)

Nick Humrich
Nick Humrich

Reputation: 15755

There are a few things going on here. First, you need to understand the difference between add and commit.

add stages your files for tracking.

commit submits the changes, and untracks the file. (The idea is that you are done with it now.)

On your first try, you added the files to track, but didnt add any changes to version control. When you do push, it pushes your commits. Because there were no commits, it said everything was up to date, which is correct.

Second, you tried to commit your changes. Git requires an email address from a user in order to submit changes. This is so you know who made the change. You have not yet told git your email address, so it is requiring you to do so before a commit will succeed. All you need to do, is do the command the message told you too. Use any email/name you like. If this is for a company, you should probably use your @company email address. If this is for github, you should use the email that you used to sign up with github. Otherwise, it doesnt matter, just use one that is you.

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

Then proceed with a commit:

git commit -m "first commit"

Upvotes: 1

Related Questions