How Do You Solve a “No such host is known” Problem with Git Commands?

Problem scenario
You are running an SSH git command (to interact with GitLab, GitHub or some Git repository), but you get “No such host is known” message. What should you do to troubleshoot this problem?

Possible Solution #1
Use “git clone git@gitserver.acme.com” (instead of “ssh git@gitserver.acme.com”; you need to use the git command first).

Possible Solution #2
Try to ping gitserver.acme.com.

What is Knowledge of Merging Strategies in the Context of Git?

Question
What are different merging strategies in the context of Git?

Possible Answers
“…branches are completely useless unless you merge them…” – Linus Torvalds

A branch is a set of files associated with a code base usually in a collection known as a repository. Atlassian says “[b]ranching is a feature available in most modern version control systems…”,

Is It a Best/Recommended Practice to Use Branching with Version Control Systems?

Problem scenario
You are debating on using branching with your repositories or using trunk-based development (with virtually no other branches). Is it a best practice to develop on the mainline (with branching infrequently if ever)?

Solution
Maybe. It is not clear.

In Support of the “Yes” / You Should Use Branches
In practice many companies use Git Flow or other branches in their Git repositories.

How Do You Determine the GitHub Enterprise URL for the API Endpoint?

Problem scenario
You want to run some curl commands to invoke a GitHub Enterprise URL. You tried using “https://api.github.foobar.com/…”, but you get a message about the URL not resolving. How can you find out what the API endpoint is?

Possible Solution
Try “https://github.foobar.com/api/v3/…” instead. Although Github.com uses the “api” immediately after the “https://” constructor (and to the left of the “github…” section),

How Do You Find the Details of Permissions/Privileges of a User in GitHub Enterprise?

Problem scenario
You are using GitHub Enterprise. You want to see the details of a user’s permissions (e.g., when it was created or before someone modified the user’s ability to control repos). What do you do?

Solution

  1. Go to the Audit Log in the web UI. (To learn more about this, see this external site.)
  2. Search for the user by the username.

How Do You Find a File by Name in GitHub (when it is not otherwise showing up)?

Problem scenario
You are searching GitHub for a file by its name. But for some reason it is not showing up in the results. What should you do?

Solution
Use the “filename:” option in the search terms before the name of the file you are looking for.
org:coolorgname filename:rio.yml

For some reason this “filename:” option returns more results.

How Do You Unlock a GitHub Repository when You Only Know Its Name?

Problem scenario
You want to unlock a GitHub repository. You know the name of the repo. (When you browse to it in a web browser, you see that it is locked, and you cannot see the files inside as normal.) How do you unlock it?

Solution
You need to find the migration GUID for the locked repository. Then you need to run a command on it.

How Can a Base Branch Not Be a Master Branch in Git?

Problem scenario
You have seen the term “base branch” in Git documentation. How can it not be the main branch?

Solution
In the context of a Pull Request, where one branch’s changes will update the same files (if any exist) and any new files will be copied into another branch, the branch receiving the changes and/or files is the base branch.