Google Source Repositories are same as any other git based repositories such as GitHub, GitLab or BitBucket and follows the same protocol as well. So it is really easy to setup and use. Without further ado, Let's jump on the steps we have to execute with assumption you are using a Linux OS-
1. Create Google Source Repository -
- Go to https://source.cloud.google.com/
- Click Add repository & Google Project where you want to create this source repository.
2. Generate the SSH
If you dont have the SSH keys in your system generate it via below commands -
ssh-keygen -t rsa -b 2048 -C "your-email-id@gmail.com"
If you are using Windows OS, you might need to install OpenSSH tool in your system to enable it for SSH -
- Download the latest OpenSSH for Windows binaries (package OpenSSH-Win64.zip or OpenSSH-Win32.zip)
- As the Administrator, extract the package to C:\Program Files\OpenSSH
- powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
- As the Administrator, install sshd and ssh-agent services:
- Once done, you can generate the SSH keys in Windows as well.
You have generated the SSH keys in last step, Next, we have to register it on Google Source Repo - https://source.cloud.google.com/user/ssh_keys?register=true , Here, we have to use public key (*.pub)
4. Clone the Repository
Now, You can clone the repository by below commands -
eval $(ssh-agent); ssh-add ~/.ssh/id_rsa # If using Linux
git clone ssh://your-email-id@gmail.com@source.developers.google.com:2022/p/your-project-id/r/repo-name
5. Work with your Repo
Next, you can start working with your repository as any other git repo system.
cd repo-name
echo "This is a google repo" >> ReadMe.md
git add ReadMe.md
git commit -m "This is my initial commit"
git push -u origin master
No comments:
Post a Comment