i studying git , @ first seems ok when try push changes in master file 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 update checked out branch: refs/heads/master remote: error: default, updating current branch in non-bare repository remote: error: denied, because make index , work tree inconsistent remote: error: pushed, , require 'git reset --hard' match remote: error: work tree head. remote: error: remote: error: can set 'receive.denycurrentbranch' configuration variable remote: error: 'ignore' or 'warn' in remote repository allow pushing remote: error: current branch; however, not recommended unless remote: error: arranged update work tree match pushed in remote: error: other way. remote: error: remote: error: squelch message , still keep default behaviour, set remote: error: 'receive.denycurrentbranch' configuration variable 'refuse'. c:\wamp\www\mygit\myfirstgit ! [remote rejected] master -> master (branch checked out) error: failed push refs 'c:\wamp\www\mygit\myfirstgit' ok here's did:
i create master folder
-- c:\wamp\www\mygit\myfirstgit
checkout folder \www
-- c:\wamp\www\myfirstgit
i created 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 ..." include in committed)
readmenothing added commit untracked files present (use "git add" track)
add , commit changes
c:\wamp\www\myfirstgit>git add readme
c:\wamp\www\myfirstgit>git commit -m "my first commit"
[master (root-commit) 43bad4e] first commit 1 file changed, 1 insertion(+) create mode 100644 readme
then push changes:
-- c:\wamp\www\myfirstgit>git push origin master
i tried pointing out directory error:
c:\wamp\www\myfirstgit>git push origin c:\wamp\www\mygit\myfirstgit fatal: remote part of refspec not valid name in c:\wamp\www\mygit\myfirstgit then got error above.
can me this? new in using tool.
thanks.
the typical use case remote repositories in git remote repository used exchanging code other developers, , backup. such central repository bare, meaning doesn't contain working directory; contains git history. pushing changes non-bare repositories bit problematic, have discovered.
if want keep first repository non-bare (so has working directory , can work directly files inside it), go c:\wamp\www\mygit\myfirstgit , run git checkout --detach head. now, push should work. note, though, files in working directory c:\wamp\www\mygit\myfirstgit not change, repository won't automatically check out changes pushed (the error message said tried push active branch, , have required working directory in c:\wamp\www\mygit\myfirstgit change, , git doesn't support that).
otherwise, can recreate remote repo bare (assuming contents initial commit still exists in c:\wamp\www\myfirstgit): delete under c:\wamp\www\mygit\myfirstgit, including hidden .git directory, , run git init --bare . there; then, push again c:\wamp\www\myfirstgit.
Comments
Post a Comment