0

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)') 
2
  • 1
    The second try is better and tells you exactly what to do. Also, read a Git tutorial please. Commented Dec 12, 2014 at 18:20
  • @poke but I am getting error in second step..do I need to do git config for both email and name...and if yes then what email | name I need to set in this phase ..and after doing this what else command I need to run ? Commented Dec 12, 2014 at 18:24

1 Answer 1

1

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" 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.