Skip to content Skip to sidebar Skip to footer

How to Upload Source Code Google Developer

Create a code repository in Cloud Source Repositories

In this quickstart, yous create a repository in Deject Source Repositories. Y'all then commit the lawmaking for a modest Python app that you can deploy after to App Engine.

Deject Source Repositories are private Git repositories hosted on Google Cloud. These repositories let you develop and deploy an app or service in a space that provides collaboration and version control for your code.

Before y'all brainstorm

  1. Sign in to your Google Cloud business relationship. If yous're new to Google Cloud, create an account to evaluate how our products perform in existent-globe scenarios. New customers also go $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud Panel, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Deject projection. Learn how to check if billing is enabled on a project.

  4. In the Google Deject Console, on the project selector page, select or create a Google Cloud project.

    Go to projection selector

  5. Brand sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.

  6. Install and initialize the Google Cloud CLI.
  7. Verify that you lot have the latest version of Git.
  8. If you have not configured your user credentials in Git, follow the start time setup instructions.
  9. Enable the Cloud Source Repositories API.
  10. Enable the Deject Source Repositories API

Create a repository

In a concluding window, use the gcloud source repos create command to create a Google Deject repository named hello-globe:

            gcloud source repos create hi-world                      

Clone a repository

Utilize the gcloud source repos clone command to clone the contents of the Google Cloud repository into a local Git repository:

            gcloud source repos clone hello-globe                      

Create a " Howdy, Earth!" script

Create a Python script that prints Hello, Globe! in a browser window.

  1. Go to your how-do-you-do-world repository.

  2. Using a text editor, create a file named main.py, and so paste the following lawmaking:

                    #!/usr/bin/env python  import webapp2  form MainHandler(webapp2.RequestHandler):     def get(self):         cocky.response.write('Hello, World!')  app = webapp2.WSGIApplication([     ('/', MainHandler) ], debug=True)                              

Create an app.yaml file

Create an app.yaml file that contains the configuration information yous need to deploy your code to App Engine.

  1. Go to your hello-world repository.

  2. Using a text editor, create a file named app.yaml, and and then paste the post-obit configuration information:

                    runtime: python27 api_version: ane threadsafe: yep  handlers: - url: .*   script: main.app  libraries: - name: webapp2   version: "2.five.2"                              

Push button to Deject Source Repositories

Push the files you just created into Cloud Source Repositories.

  1. In a terminal window, get to your hello-world directory:

                    cd howdy-world                              
  2. Add together the files:

                    git add together .                              
  3. Commit the files to the repository with a comment describing the history of this action:

                    git commit -g "Add Hello World app to Cloud Source Repositories"                              
  4. Using the git push button command, add together the contents of the local Git repository to Cloud Source Repositories:

                    git push button origin master                              

    Git pushes the files from the master branch to the origin remote. Output similar to the following is displayed:

                    Counting objects: 21, washed. Delta compression using up to 6 threads. Compressing objects: 100% (20/20), done. Writing objects: 100% (21/21), ix.76 KiB | 0 bytes/due south, done. Total 21 (delta 5), reused 0 (delta 0) remote: Storing objects: 100% (21/21), washed. remote: Processing commits: 100% (six/6), done. To https://source.developers.google.com/p/example-project-1244/r/repo-name  * [new branch]      main -> master                              

View files in the repository

  1. In the Google Cloud Console, open Cloud Source Repositories.

    Open Cloud Source Repositories

  2. Click the proper name of the hi-earth repository that y'all created.

  3. Go to the files you pushed to the repository.

    The GCP Console shows the files in the principal branch at the most recent commit.

  4. In the Files list, click a file to view its contents.

    Screenshot that shows the Files list in Cloud Source Repositories

Y'all can also view the files by using Deject Shell.

Clean up

With your howdy-earth repository in identify, you can proceed to explore Cloud Source Repositories. For a complete list of bachelor quickstarts, run into Quickstarts.

If y'all're finished with this repository, you lot can delete it by following these steps.

  1. In the GCP Panel, open the All repositories page for Cloud Source Repositories.

    Open Cloud Source Repositories

  2. Agree the pointer over the repository you want to delete and click Settings .

    The General settings page opens.

  3. Click Delete this repository .

    The Remove repository dialog opens.

  4. Type the proper noun of the repository you want to delete.

  5. Click Delete.

What's next

  • Learn more well-nigh setting up a repository.
  • Learn more than well-nigh cloning a repository.
  • Learn how to add a repository every bit a Git remote.
  • Learn how to connect a repository hosted on GitHub or Bitbucket.

vivancodosever93.blogspot.com

Source: https://cloud.google.com/source-repositories/docs/create-code-repository

Post a Comment for "How to Upload Source Code Google Developer"