I'm trying to set up Git for better version control on my current site build (this is my first time using Git) - I've just been manually duplicating files and I feel that Git's commit system is a much better solution.
I'm running MacOS 10.11, and have installed Git using Xcode. On my remote server I used the following commands using Terminal in an SSH session:
mkdir ~/.git
cd ~/.git; mkdir project.git; cd project.git
git init
Initialized empty Git repository in /home/user/.git/project.git/.git/
On my local system I used $which git
Which returned /usr/bin/git
I then used the git init
command on my local machine, which returned initialized Git repository in /Users/user/.git/
. So far, so good.
Then I used the following command git remote set-url origin ssh://username@site.com:/home/.git/project.git
(obviously with the correct user details)
Using git remote -v
gets me:
git remote -v
origin ssh://username@site.com:/home/.git/project.git (fetch)
origin ssh://username@site.com:/home/.git/project.git (push)
so all seems to be working. The problem comes here. In Coda 2 in the source tab I only have 'local' showing and no remote drop down.
Additionally in Terminal, if I try and use the command git push origin --all
I get the following error:
stdin: is not a tty
fatal: '/home/.git/project.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Does anyone have any idea where I am going wrong? I'm assuming its something simple but I've read through lots of similar answers on here and been unable to identify the problem. I've also tried reinitialising the git dir to no joy!
Ok so I solved this by taking the following steps from scratch -
I created a new git repository on my Server by SSHing in to my box and using the following
mkdir git
cd git
git init --bare project.git
Once that was done I created a new root directory on my local machine for files and using terminal cloned the remote git repository
git clone ssh://user@example.com/path/to/project.git
cd project
I then set everything up within Coda and used this as local root as
my file directory. This gave me 'local' in version control but not
remote.
I edited my files in Coda and added them to the repository using the SCM sidebar.
Once they were added I pushed them to the server using a terminal
command and then went back to coda, saved, quit the site and then my
'remote' folder appeared in the Source tab within the site set-up.
All seems to be working and giving me push and pull!