Reputation: 1603
I've been reading tutorials all day, and I still can't start to maintain my website with git.
Git is set on my hosting provider. I have one folder which will be updated, and I have a local copy of it. I already made some changes but git push origin master
command doesn't nothing.
I think I managed to set remote URL to .git/config
. When I try git remote show origin
it says:
* remote origin
Fetch URL: ssh://path to folder
Push URL: ssh://path to folder
HEAD branch: (unknown)
I also typed git init --bare
in my remote folder I want to update.
This is the part where I lose track. I don't understand what are the next steps? Basically, I want to upload my local files on that folder on my server and when I make changes locally I want to be able to push it online so I don't have to use FTP.
Upvotes: 0
Views: 749
Reputation: 164819
I think the misunderstanding here is you're trying to use Git to upload changes to your web site. It can be crammed into doing that, but it's a poor use of Git. Git is not a release manager. There's two ways of handling this.
One is to use Git purely as a version control system. It records when and why you made changes. Use something else to upload those files to your production web server.
The other is to, again, use Git as a version control system, but you can also use it to deploy your changes. The main thing is that you cannot/should not use Git to push changes to production. Instead, push your changes to a central bare repository, this could be Github or a different directory on your server, and then pull the changes to production.
In brief...
The advantages of this setup is you have a complete checkout in production, so you always know what version you have installed. You also can tell if it's been hot patched with git diff
and you can commit and push those hot patches back.
The disadvantage is your release/install process is just copying files. Each file has to be ready to go. Another is to be careful that the .git
directory is not visible to the public.
Upvotes: 2
Reputation: 188
What your doing is continuous deployment. If your repo is setup have you staged the files by running
git add --all
After staging the file you need to commit the changes
git commit -m "initial commit"
After your commit then you can run the push command
git push -u origin master
If the above has all been done can you review the repo with and post the reply so we can help more:
git status
git log
Upvotes: 0