On Mar 7, 2017 4:11 PM, "Sanjeev Sariya" <sanjeevsar...@gmail.com> wrote:

Hello There,

I'm new to git and trying to get learn basic features.


Hi Sanjeev. You might find useful our presentation on Git Basic Concepts
and Definitions: https://youtu.be/j6Se3jH60dA

Best,
Aleksey



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:

> Counting objects: 3, done.
> 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:'



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.

-- 
You received this message because you are subscribed to the Google Groups
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to gitlabhq+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/gitlabhq/e3e8d966-c9f3-4643-bcf0-0e4f80086d73%40googlegroups.com
<https://groups.google.com/d/msgid/gitlabhq/e3e8d966-c9f3-4643-bcf0-0e4f80086d73%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to gitlabhq+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/gitlabhq/CANNWuVX2czYrQ4UMBXknso%2BsKoLwQ5NzkAmJ1r0FHjAW3JJNUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to