Hello There,

I'm new to git and trying to get learn basic features. I've server on 
remote local which has code. I'd refer to it as *server*.
Am on my local machine from which I'd edit the code. I'd refer to it as 
*local*. 

On server I create new directory and do 

 git init


I add file and commit it to git.

Next, I add id_pub to authorized key. 

On local I create new directory and do 

git init


Go to local add remote

git remote add origin ssh://user-name@server_IP_address:path/git/alphatest 



I do git fetch/pull to get file. I modify it, add and commit it to git. 
Things go fine until then. However, when I try to push it using

git push -u origin master

or

git push origin master

or

> git push

 
None of these work. I get following error with 2nd command. 

Error:
> Writing objects: 100% (3/3), 267 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 ssh:// ! [remote rejected] master -> master (branch is currently 
> checked out)error: failed to push some refs to 'ssh:'

 

> Counting objects: 3, done.

However, on *local* if I do 

git push origin master:*foo* 


And on *server* I do

git merge *foo*


 Things work fine.

I'm unable to understand what is going wrong and why I've to add branch. I 
found the solution from SO link 
<http://stackoverflow.com/a/32870283/2740831>.

Any help shall be great.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to