How to deploy branch specific code using GIT? - git-ftp

I am using separate servers for dev, test and production environments. I have git installed on my local machine and have separate branches for each environment. How can I deploy the code from each branch to its respective server using GIT?
FYI: GIT is not installed on server.
Thanks in advance.
Simrat

You should have git installed on server,
use the following command to push you code to your remote repository
git push remote_repository_url branch_name
use the following commands to fetch or deploy the code from remote repository to your corresponding machine .
git pull remote_repository_url branch_name
or
git fetch remote_repository_url branch_name
Use fetch command to avoid the merging
Even you can use git clone command to clone the specific branch from your remote_repository(assembla) to your corresponding server >
git clone --branch branch_name remote_repository_url

Related

django digital ocean git

I have set up my python, virtualenv, django environment in my digital ocean Ubuntu droplet. I have also set up SSH access to be able to deploy using git. I have set a remote url, so to push I just use "git remote live master". I have used git webhooks to push remotely. Since I used git init --bare for my remote repo, I cannot see the source code, I just see the hooks folders, etc.
The only issue is after pushing to the remote repository, how do I connect that repository to my django environment so that I can run it, access those source codes, so that I can do "python manage.py runserver"? I am a beginner to webhosting automatic deployment using git and django, I do appreciate your help.

Possible way to add multiple git repositories in the same Google cloud project

Is there a way to add multiple git repositories in the same Google cloud project?
You currently cannot do this. We know this is a useful feature, and we're working hard on it. Stay tuned!
We've added the ability to have multiple Cloud Source Repositories for every cloud project.
You can read about how to add a new repo to your project here: https://cloud.google.com/source-repositories/docs/setting-up-repositories
There is no way of doing this as of today. Every project can only have one remote repository.
Git submodule should do the trick. Add git repositories as submodules.
See
https://git-scm.com/docs/git-submodule
https://git-scm.com/book/en/v2/Git-Tools-Submodules
No, there isn't, but you can use Git subtree merges to add multiple "subrepositories" as folders in your main repository, which will do the trick.
See details here https://help.github.com/articles/about-git-subtree-merges/
(There are also submodules as #Shishir stated, but as I understand they are only set for your current local clone and won't be included in checkouts/clones done by others, so I think submodules won't work).
Every Google cloud project can only have one remote repository.
However, t's definitely possible to have multiple local repositories that correspond with the same remote Google cloud repository.
The official documentation describes the following procedure for how to use a Cloud Source Repository as a remote for a local Git repository :
Create a local Git repository
Now, create a repository in your environment using the Git command
line tool and pull the source files for a sample application into the
repository. If you have real-world application files, you can use
these instead.
$ cd $HOME
$ git init my-project
$ cd my-project
$ git pull https://github.com/GoogleCloudPlatform/appengine-helloworld-python
Add the Cloud Source Repository as a remote
Authenticate with Google Cloud Platform and add the Cloud Source
Repository as a Git remote.
On Linux or Mac OS X:
$ gcloud auth login
$ git config credential.helper gcloud.sh
$ git remote add google https://source.developers.google.com/p/<project-id>/
On Windows:
$ gcloud auth login
$ git config credential.helper gcloud.cmd
$ git remote add google https://source.developers.google.com/p/<project-id>/
The credential helper scripts provide the information needed by Git to
connect securely to the Cloud Source Repository using your Google
account credentials. You don't need to perform any additional
configuration steps (for example, uploading ssh keys) to establish
this secure connection.
Note that the gcloud command must be in your $PATH for the
credential helper scripts to work.
It also explains how to create a local git by cloning a Cloud Source repository :
Clone a Cloud Source Repository
Alternatively, you can create a new local Git repository by cloning
the contents of an existing Cloud Source Repository:
$ gcloud init
$ gcloud source repos clone default <local-directory>
$ cd <local-directory>
The gcloud source repos clone command adds the Cloud Source
Repository as a remote named origin and clones it into a local Git
repository located in <local-directory>.

Deploying Flask app using Dokku

I have a Flask app deployed using dokku and now I want to modify the code and redeploy it. All the documents I found online says that I need to add git remote using below command
git remote add dokku dokku#mydomain.com:test
git push dokku master
Do i need to specify the domain.com:test as the domain name of my Flask application or it should be the git repo?
We need to add remote as below and then push the changes.
git remote add dokku dokku#<IP of server where app is hosted>:<App Domain Name>
Then verify remote is added using git remote -v
git push dokku master -- to publish the change

How to clone git repo from EC2

I have set up a django project on EC2 following https://shirtdev.wordpress.com/2011/05/04/setting-up-a-git-repository-on-an-amazon-ec2-instance/. Now I want to clone it so that I can develop locally. The instructions in the tut say:
git clone username#hostname.com:the_project.git
I know this can't be right because I would need to use a private key and the path to the project is:
/home/ubuntu/tproxy/testproject
How cam I clone this repo?

Spree Starting Server

I cloned the git repository onto a local machine and Amazon Web Services.
I've tried using script/server and rails s
The code is cloned using git://github.com/spree/spree.git
How do you start the server?
I'd rather use the full git so I can ultimately change the template.
Check out the section on the github page under "Working With Edge Source"
https://github.com/spree/spree
Clone the Git repo
git clone git://github.com/spree/spree.git
cd spree
Install the gem dependencies
bundle install
Create a sandbox Rails application for testing purposes (and automatically perform all necessary database setup)
bundle exec rake sandbox
Start the server
cd sandbox
rails server
I just checked it out and it works, but edge currently isn't working. You might just want to fork it and use your own fork as a gem for a standard spree-store set up.