I am studying git and at first it seems ok but when I try to push the changes in the master file I got these errors:
Counting objects: 3, done.
Writing objects: 100% (3/3), 232 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To C:\wamp\www\MyGit\myfirstgit
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'C:\wamp\www\MyGit\myfirstgit'
Ok here's what i did:
I create my master folder
-- C:\wamp\www\MyGit\myfirstgit
Checkout the folder to \www
-- C:\wamp\www\myfirstgit
I created a README file
-- C:\wamp\www\myfirstgit>echo 'TEST README' > README
Check status C:\wamp\www\myfirstgit>git status
On branch master
Initial commit
Untracked files: (use "git add ..." to include in what will be committed)
READMEnothing added to commit but untracked files present (use "git add" to track)
Add and commit the CHANGES
C:\wamp\www\myfirstgit>git add README
C:\wamp\www\myfirstgit>git commit -m "My first commit"
[master (root-commit) 43bad4e] My first commit 1 file changed, 1 insertion(+) create mode 100644 README
Then I push the changes:
-- C:\wamp\www\myfirstgit>git push origin master
I also tried pointing out the directory but error:
C:\wamp\www\myfirstgit>git push origin C:\wamp\www\MyGit\myfirstgit
fatal: remote part of refspec is not a valid name in C:\wamp\www\MyGit\myfirstgit
Then I got the error above.
Can you help me with this? I am new in using this tool.
Thanks.