ProgramaciónInfoGit Configuration

Git Lab Config to create a SSH Key

  • To create a SSH Key:

    ssh-keygen
    
  • To get the SSH Key

    cat /c/Users/Steph/.ssh/GitLab.pub
    

Git Commands

  • To config the username and email
	git config --global [user.name](http://user.name/) "Stephanie Mora"
	git config --global [user.email](http://user.email/) "[stefamora1@gmail.com](mailto:stefamora1@gmail.com)"
  • To initialize a repository

    git init
    
  • To clone a repository:

    git clone https or ssh
    
  • To review the status, it would show if you have new files

    git status
    
  • To add new files (Used to marks changes to be included in the next commit)

    git add
    git add .
    
  • To register the changes in the repository

    git commit -m "First commit"
    
  • To upload the changes and new files to GitLab

    git push -u origin master
    
  • To show all the commits we have done

    git log
    

GitHub

  • To create a new repository on the command line
echo "# RepositorioGitCurso" >> [README.md](http://readme.md/)
git init
git add [README.md](http://readme.md/)
git commit -m "first commit"
git branch -M main
git remote add origin https....
git push -u origin main
  • To push an existing repository from the command line
git remote add origin [https://github.com/stephanie-mora/RepositorioGitCurso.git](https://github.com/stephanie-mora/RepositorioGitCurso.git)
git branch -M main
git push -u origin main

CMD commands

  • To clean the information use
cls
  • To create a new folder
mkdir nameFolder

GitLab Configuration with Azure for deployment

You will be navigated to a very simple page with the text "ssh-rsa ". Copy the text without the beginning and trailing quotation marks to a text editor. We will use this later on.

  • Go to your GitLab repository . Then, go to setting and select Repository. Expand the Deploy Keys. Input your desired deploy key name in the Title field. Paste the generated public SSH key from Kudu into the Key field. Leave the Grant write permissions to this key checkbox unchecked (since we only need to give read access to Kudu for deployment) and click Add key. (The Grant write permissions to this key is optional).

  • The next procedures will allow us to automate the deployment to Azure everytime there are new changes in that branch using webhooks. First, we need our app credentials so that our webhook can authenticate to Kudu and let it deploy our application using its deploy endpoint.

The deploy endpoint format: [https://<sitename>:<password>@<sitename>.scm.azurewebsites.net/deploy](https://<sitename>:<password>@<sitename>.scm.azurewebsites.net/deploy](https://%3csitename%3e:%3cpassword%3e@%3csitename%3e.scm.azurewebsites.net/deploy)

Built with LogoFlowershow