Git push remote work but no changes visible - deployment

I am currently facing a little problem with git when pushing to my remote server.
Everything works fine on local server, it commit successfully and so do push to my remote repo. Git show master and git show remote-repo/master show the commits modifications done so everything should normally work.
Still when accessing my website nothing has changed. The files simply haven't changed. The remote repo is a bare one, my app is built with Flask, Gunicorn and I use supervisor to manage it. I tried to change git remote path to a new directory created with copy of my files in it, restart supervisor and gunicorn, restart my server, but nothing changed. What is strange is that first push worked. I'd net on a problem of directory structure or oath, still everything is the same. Except that my files are stores in one more directory than local. But i tried to copy files in the upper directory and it did not change anything.
I am kinda lost now and would be grateful for decades for any help or clues about this problem.
Thanks !!

Still a little confused on your set up. You develop on local and push to a server. Does the server have the bare repo or does the server hosting the website have the bare repo?
When you push to a bare that doesn't mean the working tree has changed since bare is just a bare repo- no working tree. If this is the case you have to follow these steps:
1. push from local to server that contains bare
2. pull from the remote bare location from the production server
(the one that contains the website)
3. restart apache or whatever you have
Hope this helps. Please let me know if I am on the right track.

Ok so i've got it working finally ! To do so i init another --bare repo and created a folder for website files. Then, in the bare repo, add to /hooks folder a post-receive SH/script file to check-out files when push received from bare directory to the one for website files. I edited supervisor conf and nginx one, reloaded and restarted all. it's okay now !

Related

New Web Dev person and need help on GitHub

I am new to GitHub and having issues uploading a website.....
When I upload to GitHub, it separates folders (Here is the image of what I am seeing GitHub) and thus website doesn't display properly.
Here is the image of the file on my computer Here is what I am seeing on computer
I attached screenshots, any help would be great....
I am confused af at this point in time
Try To push changes correctly as it doesn't happen usually. Read this:
Open your Command prompt first then move to the particular which here contains your whole website.
Start with
git init (it will initialize your folder to be pushed up or pulled
to git Controls)
then git add . (To add All the files create your
.gitignore file carefully)
git commit -m "Whatever you want to write
us a note about the changes"
then git push -u origin main
Hope Your problem will be solved or maybe something you can only diagnose because you are there sitting and functioning
**Note If there is any folder containing called .git, delete that. Before proceeding the way I mentioned **

GitHub Desktop doesnt pick and push the entire repository

I am using GitHub desktop application on my local machine and when I create and complete my repository(web directory)on my local machine, then I push it GitHub online through desktop application. But here is my problem:
Sometimes it doesn't pick and push all of the files/folders from my local repository, it only pick 3 files, while my repository has 5 folders and one inex.html file.
And sometimes it works perfectly fine. I never understand where is my problem. Any thoughts on this?
Do a git status before your push, as well as a git show HEAD to check the content of your last commit.
That way, you will see if there remain some files not added to the index or not committed.
And you will see if every files you wanted is in a commit.
If one file is consistently ignored, see if it is actually ignored by Git with:
git check-ignored -v -- a/file

Use Git list output to copy files for archiving

I'm currently helping to maintain a project for a client remotely. I'm the only developer ergo some of my unorthodox approaches/thinking.
the problem
The client is using Visual Studio 2010 + Team Foundation Server for their source control. I am working on a Mac over VPN and have tried several approaches to make committing to their TFS workable. I've tried TFS plugin for Eclipse with no luck (VPN really hoses the connection to TFS). Currently I am having to do a full "checkout for edit" through a virtual machine to the TFS, then transferring the project over the VPN to overwrite those files. Not a sustainable solution to say the least.
the solution?
I'm wondering if there is a way to:
get a list of changed files from GIT (I think this is the solution
(How to list all the files in a commit?)
then use that list as a means to go in and fetch those file, maintaining their folder structure
from there I can do my dump over
VPN into the VM that has the project mapped in TFS.
Or if there is something I've overlooked or hadn't thought of, please do recommend them, I'm all ears.
First, I'm assuming you are running the VM on or near the TFS server, not on your Mac. If not, you can just share a directory using VMware/VirtualBox and edit away on your Mac...
It sounds like you could achieve what you want with plain old Git. If you:
Create a bare repository on the VM (git init --bare)
Add a post-receive hook to copy the files from the master branch (for example) into the TFS directory, overwriting merrily (http://git-scm.com/book/en/Customizing-Git-Git-Hooks)
Initialise your local copy of the source as a Git repository (git init)
Add the remote repository. Assuming it's a Windows box you can use an SMB shared folder over the VPN so your remote is "local" as far as Git is concerned. (git remote add tfsserver file:///Volumes/tfsmount/code
Your first push will be expensive (but you could prepopulate the remote repo to get around that), but subsequent pushes would be just the changesets. The post-receive hook would then take care of updating the files, and you're laughing.
Of course, you then get to impress them with how amazing Git is, get them to migrate, and your problem goes away forever :).
Update: Here's a link which describes these steps in more detail, under the guise of updating a remote website: http://toroid.org/ams/git-website-howto.

github - attempting to push/pull/update (not sure of the terminology) updated code from github to remote server via terminal/ssh mac os

So I have my local computer - where I've updated my (html/js/css) code, github (where I've pushed the updated code already by doing a git add + git commit + git push origin master) and then the server of the actual website which the code is for.
I've connected to the server via the command line terminal. I've already previously cloned the code to the server (by running the command git clone [REPO URL]) while logged in to the server via SSH, so the (un-updated-)files are there.
But now that I've updated the code, and pushed that update to github, how do I now update or push the repo/code/updated-github-code to the server???
I'm currently looking at the terminal with
[~]#
^ showing. I tried to git clone [REPO URL] again, but then I get the msg:
fatal: destination path 'name of my file' already exists and is not an empty directory
Am I missing or overlooking a step? Well obviously I am but I could use some help please. Like I said I'm trying to update the code to the server so the actual website will reflect the changes I made to the code and so everything is in sync (local code, code pushed to github and hopefully/eventually the code on the server/website).
I am just learning this obviously, so go easy on me (I've spent almost the entire day learning to connect to the server via SSH in terminal)...
Also, feel free to correct my terminology...
Pull from github while ssh'd into the server using the link from the github repo "copy to clipboard" button on the web interface. If that doesn't work you could try wiping the repos folder on the server and cloning from scratch. But use that option with caution if downtime is unacceptable for this particular web app.

How Do I Update a Live Server Correctly Using Mercurial?

I'm new to Mercurial and version control, and although I'm only working on personal PHP application projects (until I hopefully get a job soon) I'm well overdue learning how it all works.
I've been reading about Mercurial all day, but I'm still confused on a few elements...
Firstly, I understand Mercurial CAN push my files straight to my live server, but I don't see many tutorials or examples explaining how this is done, so it leads me to think it's not used often? I currently use FTP to upload my files, and it's error prone to know which files have been modified, so I'd like to eliminate this obviously.
I also see services like BitBucket being mentioned a lot, but if I'm pushing to BitBucket how do I then get my files to my live server? Can I get only the changed files to upload via FTP, or do I need to install Mercurial on my server too or something?
Apologies if this is a basic question, I'm just a little lost as to how companies would/should use this service, and how files and uploads are handled elegantly. How should i go about version control on a personal project?
There are many ways to do that, but I'll try to narrow it down to the basic steps involved in a scenario using BitBucket:
1) Install Mercurial on both your dev machine and your live server.
2) Create a repository in BitBucket.
3) Clone the repository to your dev machine using the URL that appears in BitBucket, e.g.:
hg clone https://your_user#bitbucket.org/your_account/your_repos .
4) Clone the repository to your live server in the same way.
5) Do your dev and commit your code to the local repository on your dev machine (using hg commit). Then push the changesets to BitBucket using hg push.
6) Once you're ready to deploy the changes to your live server, log in to your live server and run hg pull -u.
I just use rsync to upload everything. If you're working by yourself, it's simple and works fine.
I set up an SSL certificate, and then made a bash shortcut ,p (target directory):
,p() { rsync -avz --delete ./ "user#server.com:/var/www/html/$#/"; }
Then, on my local host I can type ,p images and the current directory will be uploaded to mysite/images.
If you're always uploading to the same place, you can make a shortcut with no argument:
alias ,pm="rsync -avz --delete ./ "user#server.com:/var/www/html/";
Finally, if you just want to type the command:
rsync -avz --delete ./ "user#server.com:/var/www/html/