I have setup my remote git and local git on my mac I was able to create a git repo (git init myrepo) on the remote machine (Linux) Added few files and committed them no prob
You are probably pushing to a bare repository. You must clone it someplace and pull from the remote in order to see live changes.
To create a bare repository at myPath; you'll need to be logged into a shell on myIP:
Now your push should work and follow @VonC's instructions above in configuring your post-receive hook.
You are pushing to a non-bare repo (which works because of the receive.denyCurrentBranch
being set to ignore).
But it it possible that your remote non-bare repo:
I have deleted both repos on local and remote and created it again (No bare for sure)
By default, receive.denyCurrentBranch
is set to 'refuse
', so your error messages are consistent with that.
Try setting it on 'ignore', and since your remote repo is on master
, your push will go through.
But you won't see any file: you need a post-receive hook which would checkout your working tree or reset it to HEAD, for the files to actually appear.
See for instance "Git: making pushes to non-bare repositories safe"
my post-receive hook looks like this:
export GIT_WORK_TREE=..
git checkout -f HEAD
The OP reports in the comments:
the answer to the original issue is run this on the remote server:
git config receive.denyCurrentBranch ignore
Then Add
export GIT_WORK_TREE=.. git checkout -f HEAD
To your gitrepo<PATH>/.git/hooks/post-receive
That did the trick and I am now able to push files from my local to the remote repo!!!