Gitkraken Devops



  1. Gitkraken Multiple Azure Devops Accounts
  2. Gitkraken Azure Devops Invalid Token Specified
  3. Gitkraken Clone Azure Devops
-->
  • Join leading organizations using Azure DevOps with GitKraken Streamline your workflow with Azure DevOps (formerly Visual Studio Team Services or VSTS) and the GitKraken Git GUI. These tips and resources will help you successfully deploy and scale Git across your organization. Get started using GitKraken for free with Azure DevOps.
  • Voted #1 developer tool four years in a row, the GitKraken Git GUI is the flagship product in the GitKraken suite of tools built by Axosoft. It allows developers to visualize the history of their Git repositories in a colorful graph, and it simplifies complicated Git commands into drag-and-drop actions.

If your team is using Azure DevOps to host your repositories, the GitKraken Git GUI can help streamline your workflow and make working with Git much more int. Another approach (and the one employed by the Azure DevOps team) is to always make changes in the mainline, then port those to the release branch. You can read more about our Release Flow strategy. In this topic, we'll cover making changes in the release branch and porting them into mainline. Use cherry-picking instead of merging so that you. The GitKraken Git Client integrates with Azure DevOps, along with GitHub, GitLab, Bitbucket, GitHub Enterprise, GitLab Self-Managed, and Bitbucket Server. Fork does not integrate with Azure DevOps.

Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018 - TFS 2015

Connect to your Git repos through SSH on macOS, Linux, or Windows to securely connect using HTTPS authentication. On Windows, we recommended the use of Git Credential Manager Core or Personal Access Tokens.

Important

SSH URLs have changed, but old SSH URLs will continue to work. If you have already set up SSH, you should update your remote URLs to the new format:

  • Verify which remotes are using SSH by running git remote -v in your Git client.
  • Visit your repository on the web and select the Clone button in the upper right.
  • Select SSH and copy the new SSH URL.
  • In your Git client, run: git remote set-url <remote name, e.g. origin> <new SSH URL>. Alternatively, in Visual Studio, go to Repository Settings, and edit your remotes.

Note

As of Visual Studio 2017, SSH can be used to connect to Azure DevOps Git repos.

How SSH key authentication works

SSH public key authentication works with an asymmetric pair of generated encryption keys. The public key is shared with Azure DevOps and used to verify the initial ssh connection. The private key is kept safe and secure on your system.

Set up SSH key authentication

The following steps cover configuration of SSH key authentication on the following platforms:

  • Linux
  • macOS running at least Leopard (10.5)
  • Windows systems running Git for Windows

Configure SSH using the command line. bash is the common shell on Linux and macOS and the Git for Windows installation adds a shortcut to Git Bash in the Start menu.Other shell environments will work, but are not covered in this article.

Step 1: Create your SSH keys

Note

If you have already created SSH keys on your system, skip this step and go to configuring SSH keys.

The commands here will let you create new default SSH keys, overwriting existing default keys. Before continuing, check your~/.ssh folder (for example, /home/jamal/.ssh or C:Usersjamal.ssh) and look for the following files:

  • id_rsa
  • id_rsa.pub

If these files exist, then you have already created SSH keys. You can overwrite the keys with the following commands, or skip this step and go to configuring SSH keys to reuse these keys.

Create your SSH keys with the ssh-keygen command from the bash prompt. This command will create a 2048-bit RSA key for use with SSH. You can give a passphrasefor your private key when prompted—this passphrase provides another layer of security for your private key.If you give a passphrase, be sure to configure the SSH agent to cache your passphrase so you don't have to enter it every time you connect.

This command produces the two keys needed for SSH authentication: your private key ( id_rsa ) and the public key ( id_rsa.pub ). It is important to never share the contents of your private key. If the private key iscompromised, attackers can use it to trick servers into thinking the connection is coming from you.

Step 2: Add the public key to Azure DevOps Services/TFS

Associate the public key generated in the previous step with your user ID.

  1. Open your security settings by browsing to the web portal and selecting your avatar in the upper right of theuser interface. Select SSH public keys in the menu that appears.

  2. Select + New Key.

  3. Copy the contents of the public key (for example, id_rsa.pub) that you generated into the Public Key Data field.

    Important

    Avoid adding whitespace or new lines into the Key Data field, as they can cause Azure DevOps Services to use an invalid public key. When pasting in the key, a newline often is added at the end. Be sure to remove this newline if it occurs.

  4. Give the key a useful description (this description will be displayed on the SSH public keys page for your profile) so that you can remember it later. Select Save to store the public key.Once saved, you cannot change the key. You can delete the key or create a new entry for another key. There are no restrictions on how many keys you can add to your user profile. Also note that SSH keys stored in Azure DevOps expire after five years. If your key expires, you may upload a new key or the same one to continue accessing Azure DevOps via SSH.

  5. Test the connection by running the following command: ssh -T git@ssh.dev.azure.com.If everything is working correctly, you'll receive a response which says: remote: Shell access is not supported.If not, see the section on Questions and troubleshooting.

Step 2: Add the public key to Azure DevOps

Associate the public key generated in the previous step with your user ID.

  1. Open your security settings by browsing to the web portal and selecting your avatar in the upper right of theuser interface. Select Security in the menu that appears.

  2. Select + New Key.

  3. Copy the contents of the public key (for example, id_rsa.pub) that you generated into the Public Key Data field.

    Important

    Avoid adding whitespace or new lines into the Key Data field, as they can cause Azure DevOps Services to use an invalid public key. When pasting in the key, a newline often is added at the end. Be sure to remove this newline if it occurs.

  4. Give the key a useful description (this description will be displayed on the SSH public keys page for your profile) so that you can remember it later. Select Save to store the public key. Once saved, you cannot change the key. You can delete the key or create a new entry for another key. There are no restrictions on how many keys you can add to your user profile.

  5. Test the connection by running the following command: ssh -T git@ssh.dev.azure.com.If everything is working correctly, you'll receive a response which says: remote: Shell access is not supported.If not, see the section on Questions and troubleshooting.

Step 3: Clone the Git repository with SSH

Note

To connect with SSH from an existing cloned repo, see updating your remotes to SSH.

  1. Copy the SSH clone URL from the web portal. In this example, the SSL clone URL is for a repo in an organization named fabrikam-fiber, as indicated by the first part of the URL after dev.azure.com.

    Note

    Project URLs have changed with the release of Azure DevOps Services and now have the format dev.azure.com/{your organization}/{your project}, but you can still use the existing visualstudio.com format. For more information, see Visual Studio Team Services is now Azure DevOps Services.

  2. Run git clone from the command prompt.

SSH may display the server's SSH fingerprint and ask you to verify it.You should verify that the displayed fingerprint matches one of the fingerprints in the SSH public keys page.

SSH displays this fingerprint when it connects to an unknown host to protect you from man-in-the-middle attacks.Once you accept the host's fingerprint, SSH will not prompt you again unless the fingerprint changes.

When you are asked if you want to continue connecting, type yes. Git will clone the repo and set up the origin remote to connect with SSH for future Git commands.

Tip

To prevent problems, Windows users should run a command to have Git reuse their SSH key passphrase.

Questions and troubleshooting

Q: After running git clone, I get the following error. What should I do?

A: Manually record the SSH key by running:ssh-keyscan -t rsa domain.com >> ~/.ssh/known_hosts

Q: How can I have Git remember the passphrase for my key on Windows?

A: Run the following command included in Git for Windows to start up the ssh-agent process in PowerShell or the Windows Command Prompt. ssh-agent will cacheyour passphrase so you don't have to provide it every time you connect to your repo.

If you're using the Bash shell (including Git Bash), start ssh-agent with:

Q: I use PuTTY as my SSH client and generated my keys with PuTTYgen. Can I use these keys with Azure DevOps Services?

A: Yes. Load the private key with PuTTYgen, go to Conversions menu and select Export OpenSSH key.Save the private key file and then follow the steps to set up non-default keys.Copy your public key directly from the PuTTYgen window and paste into the Key Data field in your security settings.

Q: How can I verify that the public key I uploaded is the same key as I have locally?

A: You can verify the fingerprint of the public key uploaded with the one displayed in your profile through the following ssh-keygen command run against your public key usingthe bash command line. You will need to change the path and the public key filename if you are not using the defaults.

You can then compare the MD5 signature to the one in your profile. This check is useful if you have connection problems or have concerns about incorrectlypasting in the public key into the Key Data field when adding the key to Azure DevOps Services.

Q: How can I start using SSH in a repository where I am currently using HTTPS?

A: You'll need to update the origin remote in Git to change over from a HTTPS to SSH URL. Once you have the SSH clone URL, run the following command:

You can now run any Git command that connects to origin.

Q: I'm using Git LFS with Azure DevOps Services and I get errors when pulling files tracked by Git LFS.

A: Azure DevOps Services currently doesn't support LFS over SSH. Use HTTPS to connect to repos with Git LFS tracked files.

Q: How can I use a non-default key location, i.e. not ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub?

A: To use keys created with ssh-keygen in a different place than the default, perform these two tasks:

  1. The keys must be in a folder that only you can read or edit. If the folder has wider permissions, SSH will not use the keys.
  2. You must let SSH know the location of the keys. You make SSH aware of keys through the ssh-add command, providing the full path to the private key.

On Windows, before running ssh-add, you will need to run the following command from included in Git for Windows:

This command runs in both PowerShell and the Command Prompt. If you are using Git Bash, the command you need to use is:

You can find ssh-add as part of the Git for Windows distribution and also run it in any shell environment on Windows.

On macOS and Linux you also must have ssh-agent running before running ssh-add, but the command environment on these platforms usuallytakes care of starting ssh-agent for you.

Q: I have multiple SSH keys. How do I use different SSH keys for different SSH servers or repos?

A: Generally, if you configure multiple keys for an SSH client and connect to an SSH server, the client can try the keys one at a time until the server accepts one.

However, this doesn't work with Azure DevOps for technical reasons related to the SSH protocol and how our Git SSH URLs are structured. Azure DevOps will blindly accept the first key that the client provides during authentication. If that key is invalid for the requested repo, the request will fail with the following error:

For Azure DevOps, you'll need to configure SSH to explicitly use a specific key file. One way to do this to edit your ~/.ssh/config file (for example, /home/jamal/.ssh or C:Usersjamal.ssh) as follows:

Gitkraken Multiple Azure Devops Accounts

Q: How do I fix errors that mention 'no matching key exchange method found'?

A: Git for Windows 2.25.1 shipped with a new version of OpenSSH which removed some key exchange protocols by default.Specifically, diffie-hellman-group14-sha1 has been identified as problematic for some Azure DevOps Server and TFS customers.You can work around the problem by adding the following to your SSH configuration (~/.ssh/config):

Replace <your-azure-devops-host> with the hostname of your Azure DevOps or TFS server, like tfs.mycompany.com.

Q: What notifications may I receive about my SSH keys?

A: Whenever you register a new SSH Key with Azure DevOps Services, you will receive an email notification informing you that a new SSH key has been added to your account.

Q: What do I do if I believe that someone other than me is adding SSH keys on my account?

A: If you receive a notification of an SSH key being registered and you did not manually upload it to the service, your credentials may have been compromised.

The next step would be to investigate whether or not your password has been compromised. Changing your password is always a good first step to defend against this attack vector. If you’re an Azure Active Directory user, talk with your administrator to check if your account was used from an unknown source/location.

Q: What do I do if I'm still prompted for my password and GIT_SSH_COMMAND='ssh -v' git fetch shows no mutual signature algorithm?

A: Some Linux distributions, such as Fedora Linux, have crypto policies that require stronger SSH signature algorithms than Azure DevOps supports (as of January 2021). There's an open feature request to add this support.

You can work around the issue by adding the following code to your SSH configuration (~/.ssh/config):

Gitkraken Azure Devops Invalid Token Specified

Replace ssh.dev.azure.com with the correct host name if you use Azure DevOps Server.

-->

Distributed version control systems like Git give you flexibility in how you use version control to share and manage code.Your team should find a balance between this flexibility and the need to collaborate and share code in a consistent manner.

Team members publish, share, review, and iterate on code changes through Git branches shared with others.Adopt a branching strategy for your team. You can collaborate better and spend less time managing version control and more time developing code.

The following branching strategies are based on the way we use Git here at Microsoft. For more information, see How we use Git at Microsoft.

Gitkraken Clone Azure Devops

Keep your branch strategy simple

Keep your branch strategy simple. Build your strategy from these three concepts:

  • Use feature branches for all new features and bug fixes.
  • Merge feature branches into the main branch using pull requests.
  • Keep a high quality, up-to-date main branch.
Devops

A strategy that extends these concepts and avoids contradictions will result in a version control workflow for your team that is consistent and easy to follow.

Use feature branches for your work

Develop your features and fix bugs in feature branches based off your main branch. These branches are also known as topic branches.Feature branches isolate work in progress from the completed work in the main branch.Git branches are inexpensive to create and maintain. Even small fixes and changes should have their own feature branch.

Creating feature branches for all your changes makes reviewing history simple. Look at the commits made in the branch and look at the pull request that merged the branch.

Name your feature branches by convention

Use a consistent naming convention for your feature branches to identify the work done in the branch.You can also include other information in the branch name, such as who created the branch.

Some suggestions for naming your feature branches:

  • users/username/description
  • users/username/workitem
  • bugfix/description
  • feature/feature-name
  • feature/feature-area/feature-name
  • hotfix/description

Note

For information on setting policies to enforce a branch naming strategy, see Require branch folders.

Use feature flags to manage long-running branches

Learn more about using feature flags in your code.

Review and merge code with pull requests

The review that takes place in a pull request is critical for improving code quality.Only merge branches through pull requests that pass your review process.Avoid merging branches to the main branch without a pull request.

Reviews in pull requests take time to complete. Your team should agree on what's expected from pull request creators and reviewers.Distribute reviewer responsibilities to share ideas across your team and spread out knowledge of your codebase.

Some suggestions for successful pull requests:

  • Two reviewers is an optimal number based on research.
  • If your team already has a code review process, bring pull requests into what you're already doing.
  • Take care assigning the same reviewers to a large number of pull requests. Pull requests work better when reviewer responsibilities are shared across the team.
  • Provide enough detail in the description to quickly bring reviewers up to speed with your changes.
  • Include a build or linked version of your changes running in a staged environment with your pull request. Others can easily test the changes.

Keep a high quality, up-to-date main branch

The code in your main branch should pass tests, build cleanly, and always be current.Your main branch needs these qualities so that feature branches created by your team start from a known good version of code.

Set up a branch policy for your main branch that:

  • Requires a pull request to merge code. This approach prevents direct pushes to the main branch and ensures discussion of proposed changes.
  • Automatically adds reviewers when a pull request is created. The added team members review the code and comment on the changes in the pull request.
  • Requires a successful build to complete a pull request. Code merged into the main branch should build cleanly.

Tip

The build pipeline for your pull requests should be quick to complete, so it doesn't interfere with the review process.

Manage releases

Use release branches to coordinate and stabilize changes in a release of your code.This branch is long-lived and isn't merged back into the main branch in a pull request, unlike the feature branches.Create as many release branches as you need. Keep in mind that each active release branch represents another version of the code you need to support.Lock release branches when you're ready to stop supporting a particular release.

Use release branches

Create a release branch from the main branch when you get close to your release or other milestone, such as the end of a sprint.Give this branch a clear name associating it with the release, for example release/20.

Create branches to fix bugs from the release branch and merge them back into the release branch in a pull request.

Port changes back to the main branch

Make sure that fixes land in both your release branch and your main branch.One approach is to make fixes in the release branch, then bring changes into your main branch to prevent regression in your code.Another approach (and the one employed by the Azure DevOps team) is to always make changes in the mainline, then port those to the release branch.You can read more about our Release Flow strategy.

In this topic, we'll cover making changes in the release branch and porting them into mainline.Use cherry-picking instead of merging so that you have exact control over which commits are ported back to the main branch.Merging the feature branch into the main branch can bring over release-specific changes you don't want in the main branch.

Update the main branch with a change made in the release branch with these steps:

  1. Create a new feature branch off the main branch to port the changes.
  2. Cherry-pick the changes from the release branch to your new feature branch.
  3. Merge the feature branch back into the main branch in a second pull request.

This release branch workflow keeps the pillars of the basic workflow intact: feature branches, pull requests, and a strong main branch that always has the latest version of the code.

Why not use tags for releases?

Other branching workflows use Git tags to mark a specific commit as a release.Tags are useful for marking points in your history as important. Tags introduce extra steps in your workflow that aren't necessary if you're using branches for your releases.

Tags are maintained and pushed separately from your commits.Team members can easily miss tagging a commit and then have to go back through the history afterwards to fix the tag.You can also forget the extra step to push the tag, leaving the next developer working from an older version of the code when supporting the release.

The release branch strategy extends the basic feature branch workflow to handle releases.Your team doesn't have to adopt any new version control process other than the cherry-pick to port changes.

Manage deployments

You can handle multiple deployments of your code in the same way you handle multiple releases.Create a clear naming convention, such as deploy/performance-test, and treat the environment branches like release branches.Your team should agree on a process to update deployment branches with the code from your main branch.Cherry-pick bug fixes in the deployment branch back to the main branch. Use the same steps as porting changes from a release branch.

An exception to this recommendation is if you're using a form of continuous deployment.Use Azure Pipelines when working with continuous deployment to promote builds from your main branch to your deployment targets.

Videos