How to clone a particular branch from Google CLoud Source Repository - google-cloud-platform

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>

Related

AWS EC2 - run shell and connect with git

i run a AWS EC2 Instance with a shell script, which pulls the actual git. Github changed to private token authentication. if I execute the shell I have to insert manually my user and password. but I would like to run the shell with a cronjob automatically.
#!/bin/sh
cd ~/code/NLP
git pull
python3 main.py
git add *
git commit -m "raspberry pi run"
git push origin master
i am looking for a solution to insert my git password and username automatically

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.

Google source repository integration

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.

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.