Showing posts with label Git-Pull-Push. Show all posts
Showing posts with label Git-Pull-Push. Show all posts

Create and Configure Cloud Source Repositories by generating SSH Keys and uploading from Windows Powershell.

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> ls

    Directory: C:\Users\Ketan.Patel\Downloads\planner\planner_lite

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  10:44 AM            783 planner.m
-a----         8/28/2023  10:44 AM           9485 plannerlite.py
-a----         8/28/2023  10:44 AM           2682 planner_types.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

fatal: not a git repository (or any of the parent directories): .git

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git init

Initialized empty Git repository in C:/Users/Ketan.Patel/Downloads/planner/planner_lite/.git/

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        planner.m
        planner_types.py
        plannerlite.py

nothing added to commit but untracked files present (use "git add" to track)

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git add .

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   planner.m
        new file:   planner_types.py
        new file:   plannerlite.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git commit -m "first planner commit"

[master (root-commit) 17a9789] first planner commit
 3 files changed, 348 insertions(+)
 create mode 100644 planner.m
 create mode 100644 planner_types.py
 create mode 100644 plannerlite.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

On branch master
nothing to commit, working tree clean

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote -v

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote add google ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote -v

google  ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation (fetch)
google  ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation (push)

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git push --all google

The authenticity of host '[source.developers.google.com]:2022 ([142.251.2.82]:2022)' can't be established.
ECDSA key fingerprint is SHA256:AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[source.developers.google.com]:2022' (ECDSA) to the list of known hosts.
ketan.patel@supernal.aero@source.developers.google.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

PS C:\Users\Ketan.Patel> ssh-keygen -t rsa -C "ketan.patel@supernal.aero"

Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Ketan.Patel/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Ketan.Patel/.ssh/id_rsa.
Your public key has been saved in C:\Users\Ketan.Patel/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:MuYhOj0OmqXVwNawvIlHdEIaGp7QY/f4WHt+/LDWbKY ketan.patel@supernal.aero
The key's randomart image is:
+---[RSA 3072]----+
|+..              |
|+== .            |
|o++o.o           |
| + *. o          |
|  B o+=.S        |
| + B.+o+.        |
|. X + .o ..o     |
| B + .  . +o=    |
|+   .    oE=.    |
+----[SHA256]-----+

PS C:\Users\Ketan.Patel> cd .ssh

PS C:\Users\Ketan.Patel\.ssh> ls

    Directory: C:\Users\Ketan.Patel\.ssh

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  11:00 AM           2610 id_rsa
-a----         8/28/2023  11:00 AM            580 id_rsa.pub
-a----         8/28/2023  10:58 AM            741 known_hosts
-a----         8/26/2023  10:28 AM            368 known_hosts.old

PS C:\Users\Ketan.Patel\.ssh> pwd

Path
----
C:\Users\Ketan.Patel\.ssh

PS C:\Users\Ketan.Patel\.ssh> cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCIdjrFxQyvTDX/ivpB8BgEG2TDRYmS2tCA6KUBviZ0uGpfjcwlmmk0xQVlDR511O8j86kvVzW7J48idkm5BE4fQqbIgjPx49YYfCE6oOqqg5nIBLGrQ1bBDSjkKAsAif6+jhjkp7+ku/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+SR/FnYvlsr7O6NDfsnDS4DT40qyJEBf3FAeV/TbfikWOzKAvWUJXaAr5pUhuBUlKagzLqSQDBltSlpgSnzEjTzSrLv5ONM= ketan@abc.com
PS C:\Users\Ketan.Patel\.ssh>


https://source.cloud.google.com/user/ssh_keys





 

REGISTER THE SSH KEY FROM DESKTOP:












PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> dir

Directory: C:\Users\Ketan.Patel\Downloads\planner\planner_lite

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  10:44 AM            783 planner.m
-a----         8/28/2023  10:44 AM           9485 plannerlite.py
-a----         8/28/2023  10:44 AM           2682 planner_types.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git push --all google

Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 12 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 4.25 KiB | 2.12 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Waiting for private key checker: 3/3 objects left
To ssh://supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation
 * [new branch]      master -> master
PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite>



CLONE REPO TO CLOUD SHELL :






ketan_patel@cloudshell:~ (new-user-learning)$ gcloud source repos clone simulation --project=new-user-learning

Cloning into '/home/ketan_patel/simulation'...
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5), 4.25 KiB | 4.25 MiB/s, done.
Project [new-user-learning] repository [simulation] was cloned to [/home/ketan_patel/simulation].

ketan_patel@cloudshell:~ (new-user-learning)$ cd simulation/

ketan_patel@cloudshell:~/simulation (new-user-learning)$ ls

plannerlite.py  planner.m  planner_types.py
ketan_patel@cloudshell:~/simulation (new-user-learning)$

Git Pull and Push the code

Add code to your repository

PUSH CODE FROM LOCAL GIT REPO:

USING SSH AUTHENCTION:


Your repository is currently empty. Add some code using a selected method and then refresh your browser. Contents added to this repository can take some time to show up in search results. Learn more.
Select an option to push code to your repository:
Push code from a local Git repository
Clone your repository to a local Git repository
Select your preferred authentication method
Setup SSH key. Learn how 
If you already have a SSH key on your machine, skip to step 2. Find SSH Keys on your machine .
Register the SSH key with Google Cloud.
Add your Cloud Repository as a remote:
$
git remote add google ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/ketancloudsourcerepo

Push from your local Git repository:
$
git push --all google

Once you've completed all these steps, refresh your browser.


USING GOOGLE CLOUD SDK:


Select your preferred authentication method
Install the Google Cloud SDK .
Provide your authentication credentials:
Linux/Mac OS X
Windows
$
gcloud init && git config --global credential.https://source.developers.google.com.helper gcloud.sh

Add your Cloud Repository as a remote:
$
git remote add google https://source.developers.google.com/p/new-user-learning/r/ketancloudsourcerepo

Push from your local Git repository:
$
git push --all google


USING MANUALLY GENERATED CREDENTIALS:


Select your preferred authentication method
Generate and store your Git credentials.
Add your Cloud Repository as a remote:
$
git remote add google https://source.developers.google.com/p/new-user-learning/r/ketancloudsourcerepo

Push from your local Git repository:
$
git push --all google



CLONE YOUR REPOSITORY TO A LOCAL REPO:


USING SSH AUTHENTICATION:


Add code to your repository
Your repository is currently empty. Add some code using a selected method and then refresh your browser. Contents added to this repository can take some time to show up in search results. Learn more.
Select an option to push code to your repository:
Push code from a local Git repository
Clone your repository to a local Git repository
Select your preferred authentication method
Setup SSH key. Learn how 
If you already have a SSH key on your machine, skip to step 2. Find SSH Keys on your machine .
Register the SSH key with Google Cloud.
Clone this repository to a local Git repository:
Clone with command line
$
git clone ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/ketancloudsourcerepo

Or clone with VS Code Clone
Note: This may display the following message that is safe to ignore:
"warning: You appear to have cloned an empty repository."
Switch to your new local Git repository:
$
cd ketancloudsourcerepo

After you've committed code to your local Git repository, push it to this repository:
$
git push -u origin master

If you are using a version of Git with main as the default branch instead of master, after you've committed code to your local Git repository, push it to this repository using:
$
git push -u origin main



USING GOOGLE CLOUD SDK:


Select your preferred authentication method
Install the Google Cloud SDK .
Provide your authentication credentials:
$
gcloud init

Clone this repository to a local Git repository:
$
gcloud source repos clone ketancloudsourcerepo --project=new-user-learning

Note: This may display the following message that is safe to ignore:
"Warning: remote HEAD refers to a nonexistent ref, unable to checkout."
Switch to your new local Git repository:
$
cd ketancloudsourcerepo

After you've committed code to your local Git repository, push it to this repository:
$
git push -u origin master

If you are using a version of Git with main as the default branch instead of master, after you've committed code to your local Git repository, push it to this repository using:
$
git push -u origin main

Once you've completed all these steps, refresh your browser.

USING MANUALLY GENERATED CREDENTIALS:


Select your preferred authentication method
Generate and store your Git credentials.
Clone this repository to a local Git repository:
Clone with command line
$
git clone https://source.developers.google.com/p/new-user-learning/r/ketancloudsourcerepo

Or clone with VS Code Clone
Note: This may display the following message that is safe to ignore:
"warning: You appear to have cloned an empty repository."
Switch to your new local Git repository:
$
cd ketancloudsourcerepo

After you've committed code to your local Git repository, push it to this repository:
$
git push -u origin master

If you are using a version of Git with main as the default branch instead of master, after you've committed code to your local Git repository, push it to this repository using:
$
git push -u origin main

Once you've completed all these steps, refresh your browser.

create a Data Fusion instance and deploy a sample pipeline

Create a Data Fusion instance and deploy a sample pipeline that reads an input file from Cloud Storage, transforms and filters the data to o...