I bought a personal dev box which I will use for deploying stuff I create on my laptop. I thought it would be a good idea to use Git for code management. The idea was that I will keep committing on my laptop and when needed, will push the changes to the remote dev box.
- I initialized a Git repo on the box and
- cloned it on my laptop.
But After doing
git push
I get this error: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
I know that the remote repo was not bare.
I want to ask if the only way to go with my kind of setup is:
- Initialize a bare repo on Server
- Clone it on my laptop
- add new files to the local laptop repo and commit the files
- push to the remote dev box repo
Even this setup gives me errors:
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
EDIT
I tried
git push origin master
Got this error:
error: unable to create directory for .git/refs/remotes/origin/master
error: Cannot lock the ref 'refs/remotes/origin/master'.
Oh dumb me... I think it is sudo
as in
sudo make me intelligent