How to contribute into google-stacks repo from Cloud Shell #
Creating a personal access token. Minimum required scopes are
repo
,read:org
,workflow
. Save this generated personal token in safe place (you can use it for future cloud shell sessions)Login to github with
gh
tool using a generated personal token:gh auth login -h github.com
gh
tool will ask you to select some options. Select next one:? What is your preferred protocol for Git operations? HTTPS ? Authenticate Git with your GitHub credentials? Yes ? How would you like to authenticate GitHub CLI? Paste an authentication token
Use
gh
tool as git credentials helpergh auth setup-git
Configure git client
Set git user name and email manually
git config --global user.name "<your_user_name>" git config --global user.email "<your_user_email>"
or use your Github user name and email as
<your_github_username>@users.noreply.github.com
git config --global user.name "$(gh api https://api.github.com/user | jq -crM '.login')" git config --global user.email "$(echo "$(git config --global user.name)@users.noreply.github.com")"
or use your current GCP user name and email
git config --global user.email "$(gcloud auth list --verbosity=none --filter=status:ACTIVE --format="json(account)" | jq -cMr '. | first | . account')" git config --global user.name "$(echo "${USER/_/ }" | sed -e 's/^./\U&/g; s/ ./\U&/g')"
Before making changes create git branch
git checkout -b <your_branch_name>
Make your changes and commit them
git add -A . git commit -m "<your_commit_message>"
Create Github Pull Request
gh pr create --title "<your_pr_title>" --body "<your_pr_description>"
gh
tool will ask you a questionWhere should we push the '<your_branch_name>' branch?
selectCreate a fork of agilestacks/google-stacks
. Callinggh pr create
will create a fork repo in your Github account, push your branch changes and create a PR inagilestacks/google-stacks
.