October 12, 2018
GitHub Desktop is a fast and easy way to contribute to projects from Windows and OS X, whether you are seasoned user or new user, GitHub Desktop is designed to simplify the all process and workflow in your GitHub. GitHub Desktop is an open source Electron-based GitHub app. It is written in TypeScript and uses React.
It has many awesome features like:
Attributing commits with collaborators easily
Checkout branches with pull requests and view CI statuses
Syntax highlighted diffs
Expanded image diff support
Extensive editor & shell integrations
It’s open source
I personally prefer to use Github Desktop as my main git client rather than Source Tree or Gitkraken.
Last week, the company I work for, decided to move all it’s codebase from Github to Gitlab. The reason is because Gitlab has some out of the box Features like integrated devops inbuilt into their system unlike github where you’ll have to do all these yourselves.
Pre-gitlab we were using like 5 different tools and the complexity of integrating them all was getting out of hand and also quite expensive, trying to tie together New Relic, Codeship, Github, Jenkins, Chef, and Terraform was no fun… not to mention Digital Ocean, AWS, Azure, and Mongodb Cloud
I am used to the GitHub environment because that’s all I’ve always worked with but I saw this as a challenge to adapt to a new environment.
I was ready to move to Gitlab but I wasn’t ready to leave GitHub Desktop, so I decided to use Gitlab and GitHub Desktop. I began making research on how to use them both and then my boss gave me a useful resource that helped a lot, see link below:
It helped a lot but it was missing one vital step which was how to use GitHub Desktop with a Gitlab Repo that has 2FA(two-factor authentication) enabled.
so let’s revisit the steps from scratch then I’ll put in the vital step.
Disclaimer: These steps are valid for only users of the GitHub Desktop Native
i. Download GitHub Desktop here
ii. Go to your Gitlab repo
iii. Click on settings
What we’ll do now is to generate an access token for our GitHub desktop.
After clicking on settings
i. Click on Access Tokens
ii. Generate an access token
iii. Copy your new access token and store it somewhere as we’ll use it later:
i. Head over to your repository and select https and copy the link,
ii. open GitHub Desktop from the file bar, select clone repository
iii. After selecting it, a modal would pop up, select URL and place the https link we copied from gitlab inside the URL field and select the destination folder.
iv. After filling all those fields, select clone
v. While cloning, it would pop up a modal titled authentication failed, you would then be required to put in your username and password.
N/B: Your username is mostly your email address or whatever username you used to access your gitlab organization or repo.
vi. Then your password would be the personal access token we created before, so head over to wherever you may have stored it and paste it.
vii. After that click login or authenticate and if all goes well you should see something like this
After that you would see this
Then you can fetch from the origin, see all branches and use it as your preferred git client.
And that’s how to use Gitlab with GitHub Desktop.
If you have any question or you don’t understand any step feel free to reach out to me on twitter or drop your questions in the comments section.