×

GCP Development : Managing Source Codes with Google Cloud Source Repositories

In closing, Google Cloud Source repositories allows developers to store, manage and keep track of the source codes of an application in a very easy, collaborative way maintaining the highest level of security within the same infrastructure with high availability.

GCP Development : Managing Source Codes with Google Cloud Source Repositories

Google Cloud Source Repositories:-

Google Cloud Source Repositories is a one stop solution for a team to store, manage and track source codes(Cloud Source Repositories are only intended to store source codes of an application and not any user or personal data. As per the Google Cloud License Agreement, one cannot store core app engine customer data). It allows the developers to collaborate easily and more securely manage the code on a fully featured, scalable, private Git Repository(To use a hosted Git repository with cloud source repository, you need to create an account with github or bitbucket which are a complete separate company from Google). It can also be used by connecting with other GCP Services such as Cloud Build, App Engine, Cloud Pub/Sub, Stackdriver. It enables fast, powerful code search across all the owned repositories to optimize the time and also facilitates Automatic serverless deployments.

Benefits of Using Google Cloud Source Repositories:-

1. Multiple Repositories - For a single google cloud project, you can create multiple cloud repositories to organize the code related to your project. It allows developers to create upto 1000 repositories per GCP Project. 

2. Integration with GCP Services - Google Cloud Source Repositories can easily be used by connecting with other GCP Services such as Cloud Build, App Engine, Cloud Pub/Sub, Stackdriver.

3. Code Search - Cloud Source Repositories utilizes the same search technologies like google search while optimizing the search indexing algorithms.

4. Source Browser - It also provides a source browser that can be used to view repository files from within the GCP Console. 

5. Auto Sync with other hosted repositories - You can connect with other hosted repositories and automatically sync changes to cloud source repositories whenever the changes are pushed to github or bitbucket. 

6. Git Operations - You can perform push, pull, clone and log(basic git operations) Also you can make changes based on the requirement of the workflow. 

7. Reliability - You can keep and manage the codes on systems distributed geographically across multiple data centres and run on the same infrastructure of GCP with high availability. 

8. Security and Debugging - It offers security key detection with push block features which goes on checking for secret credentials on the commit operation. This feature has been incorporated for better security and debugging options. 

How to Setup a New Repository on Google Cloud Source Repositories:- 

Step 1: Select Project within the GCP Console

Step 2: Search for Cloud Source Repository API

Step 3: Enable the same API

Step 4: Activate Cloud Shell - Click the ‘Activate Cloud Shell’ button at the top of the Google Cloud Console. A ‘Cloud Shell’ session opens inside a new frame at the bottom of the Console and displays a command-line prompt. It can take a few seconds for the session to get initialized.

Step 5: To create a demo repository, type the following-

gcloud source repos create my-demo-repo

Step 6: To create a clone demo repository, type the following-

gcloud source repos clone my-demo-repo

Step 7: Add files

Step 8: type, “ls” command for list

Step 9: type, cd my-demo-repo/

Step 10: type, echo "<h1> my first cloud source repository tutorial <h1>" > file1.txt

Step 11: ls

Step 12: cat file1.txt(to see the content)

Step 13: git add file1.txt

Step 14: git commit -m "file1 committed"

Step 15: git config --global user.email"utsab.dhar@infiflex.com"

Step 16: git config --global user.name "Utsab Dhar"

Step 17: git commit -m "file1 committed"

Step 18: git push origin master

Step 19: Click on the sandwich menu and go to the source repository and you can finally find the demo repo and also one can see the content added. 




Trendy