I am a beginner with git, wanting to learn and better understand how it works!
I have setup a git repository on my VPS (running Ubuntu 18.04) that's separate from the working directory using git init --separate-git-dir
. The git repository is at ~/project.git
, while the working directory is at /var/www/project/
. I also changed the branch master
to main
with git branch -m master main
.
I did the entire setup on the VPS, and later cloned the repository to my local development machine. It worked, and I got the files from the working directory copied to the local machine.
When I add a hello.txt
to my local working directory, and try to push it to the remote repository, I get the following error:
! [remote rejected] main -> main (branch is currently checked out)
I would like to know how I can continue developing this project, and "reversing" the local/remote repositories (for lack of better word), so that the one that is on my local machine can be pushed to the remote, without this problem...
I hope this makes sense – thank you for all advice and input!