Clone and create a private GitHub repository with these steps

What is a repository?

A repository is like a container, it stores your files. It is stored with a history of changes youā€™ve made. If you donā€™t get what a repo is storing or its purpose, you can read the repoā€™s README.md file.

Ever since they became a standard offering on a free tier, private GitHub repositories have become popular with developers. However, many developers become discouraged when they trigger aĀ fatal: repository not foundĀ error message in their attempts to clone a private GitHub repository.

In this tutorial, we will demonstrate how to create a private GitHub repository, then securely clone and pull your code locally without the need to deal with fatal errors.

How to create a private GitHub repository

How to create a private GitHub repository

ThereĀ arenā€™t any special stepsĀ required to create a private GitHub repository. Theyā€™re exactly the same as if you were to create a standard GitHub repository, albeit with one difference: You click the radio button for theĀ PrivateĀ option.

How to clone a private GitHub repository

How to successfully clone a private GitHub repository.

The first thing a developer wants to do after the creation of a GitHub repository is to clone it. For a typical repo, you would grab the repositoryā€™s URL and issue aĀ git clonecommand. Unfortunately, itā€™s not always that simple onĀ GitHubā€™s free tier.

If youā€™re lucky, when you attempt to clone your private GitHub repository, youā€™ll be prompted for a username, after which an OpenSSH window will then query for your password. If you provide the correct credentials, the private repository will clone.

However, if OpenSSH isnā€™t configured on your system, an attempt to clone the private repository will result in theĀ fatal: repository not foundĀ GitHub error message.

The fatal ā€˜repository not foundā€™ error on GitHub.

FixĀ repository not foundĀ errors

If you do encounter this dreaded error message, donā€™t fret, becauseĀ thereā€™s a simple fix. Prepend the private GitHub repositoryā€™s username and password to the URL. For example, if my username wasĀ camĀ and the password wasĀ 1234, theĀ git cloneĀ command would look as follows:

git clone https://cam:1234@github.com/cameronmcnz/private-github-repo.git

Since you embedded the credentials in the GitHub URL, the clone command takes care of the authorization process, and the command will successfully create a private GitHub repository clone on your local machine. From that point on, all futureĀ git pullĀ andĀ git fetchĀ commandsĀ will run successfully.

Cameron McKenzie about free private Git repo.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
Exit mobile version