Google source repository integration - google-cloud-platform

I have a git repository with multiple branches which I wanted to push to google source repository. But it takes only a particular branch of the repository. How can I create a branch on google source repository and push code to that branch only ?

create a new branch:
git checkout -b branch_name
edit, add and commit your files.
then push the branch to the remote:
git push -u origin branch_name
assuming you have already added it as remote.
see git checkout & git push.

Related

How to clone a particular branch from Google CLoud Source Repository

I am trying to clone a particular branch from Google Cloud Source Repository.
gcloud source repos clone <Repos_Name>
This command only scans the master branch not the dev branch that I am looking for
How to clone the particular brach?
clone your repo
gcloud source repos clone <Repos_Name>
2.fetch remote branch
git fetch --all
3.checkout your desire branch
git checkout <remotebranch>

git: 'remote-https' is not a git command. See 'git --help'

I have been trying to clone my repository and it shows the following error:-
git: 'remote-https' is not a git command. See 'git --help'
Here is my:-
Clone from
https://github.com/NavyaThakur/django-project1
To directory
C:\Users\91933\github\django-project1
I tried reinstalling github desktop but no use.
Please help me through this
Try git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
so for you git clone https://github.com/NavyaThakur/django-project1
Git Clone Documentation
This error means your git executable was not built with ssl and/or libcurl.
From experience this seems to be a problem on some RedHat based distributions.
If you have admin access just make use you install the correct git client. If not you will have to build git yourself or install from a repository into your user account (both of which are not trivial, sorry)

Is it good practice to add .git folder to Github?

After i entered git init I have directory D:myproject\.git
Is it good to add .git folder it in Github or should i add it in .gitignore?
You should not worry about .git folder. It contains git internals and all information in your repository like commits, branches and blobs. So .git is a repository itself and is handled automatically.
If you are in the root directory of your app and you do git init command what happens is that the command says initialize this directory and everything below it as a git repository. And it will set up a local repository for you on your machine.
Local repository on your machine allows git to track version changes in our files. Once we are happy with all those changes and our files then we push them to a remote repository on GitHub.
And you don't have to add your .git folder in .gitignore file.

Deploying a Django application in Openshift

I have a working Django application in my local machine. I tried hosting this application in Openshift, after following the Openshift official tutorial didn't get any results. Is there any proper resource to deploy local Django applications to openshift
On Openshift you can deploy Django applications using either the Django cartridge or the Python cartridge. Using the Python cartridge is often preferred as it enables you to easily install the latest version of Django using pip.
Are you using the Django or Python cartridge?
To use the Python cartridge you can follow this tutorial:
https://developers.openshift.com/en/python-getting-started.html
You mention that you already have a django application on your local machine. It can be a bit tricky to push an existing project to openshift.
If you create the application using the Python cartridge it will create a git repository for you that you then clone onto your computer. Using the website find the URI for your application repository. You should clone this onto your computer into a separate directory from your existing django project. Look into this new repository and copy the files from that repository into your existing repository. Then you can look at the remote location used in this new repository and set it as a remote in your existing django repository. Then from your existing repository push to the openshift remote using the --force flag.
$ cd /home/user
$ git clone ssh://<user_id_string>#python-yourdomain.rhcloud.com/~/git/python.git/
$ cd python
$ tree . # look at the files in the repository (wsgi.py, etc.)
$ <copy the needed files to your django dir>
$ cd ../<existing_django_dir>
$ git remote add openshift ssh://<user_id_string>#python-yourdomain.rhcloud.com/~/git/python.git/
$ git push -f openshift master
Directions on force push: Force "git push" to overwrite remote files

How to push a git submodule to AWS Elastic Beanstalk?

I have a repo named ld with a submodule named ldapp, which is a Django project. I want to push the Django project ldapp to elastic beanstalk, but I get the warning following warning when running eb init:
Warning: Your directory has not been initialized as a Git repository.
To create a local Git repository, run "git init" and then re-run the
"eb init" command.
If I continue on and run eb push I get:
git: 'aws.push' is not a git command. See 'git --help'. Cannot run
aws.push for local repository HEAD:
The way git structures submodules is it actually has the .git of the submodule be a file, not a directory. The following is the contents of the file ldapp/.git:
gitdir: ../.git/modules/ldapp
This file tells git to retrieve ldapp's versions from ld's .git directory. Since the .git versioning of ldapp is not present within ldapp itself (but rather within ld's .git), running eb init and eb push fail. How do I fix this?
I don't think you can. I had to git clone the submodule to get back a standalone Git repository.