GitHub is the most widely used hosting service provider for projects and files to manage data changes effectively. Apart from repository hosting, GitHub also offers many other services like
gists, CI/CD integration, package publication, GitHub APIs, GitHub Pages, sponsors, and much more.
create-react-app tool automatically adds a
.gitignore file that contains the names or patterns to ignore files/directories while pushing the code to the GitHub server.
GitHub are widely used to develop software in a collaborative environment. This guide explains the details of setting up a React project from a GitHub repository using different methods.
There is some important terminology related to
git files and commands that are required to understand how
gitis a tool to manage the history of a project using
gitcommands. The history details are stored in a hidden directory named
repositoryis a conventional name of a
gitproject hosted on the GitHub server.
.gitignorefiles contain the names (or patterns) of the files or directories that will neither be tracked nor uploaded to a GitHub repository by
remoteis the command used to add SSH or HTTPS URL links of a GitHub repository.
originis just a conventional name for a GitHub repository URL.
stagedcan be visualized as a bucket of files or directories whose changes are ready to be stored. The
addcommand is used to stage changes.
commitis used to store the state of all the staged files with an optional message.
pullis used to copy the code from a remote branch in the current project.
pushis used to move the committed changes to a remote repository.
The GitHub CLI brings capabilities of GitHub web UI to the command line to perform operations like creating a pull request, track issues, fork a repository, etc. Use the
auth command to authenticate the account and clone the project using the
1gh auth login 2gh repo clone UserName/RepoName
authcommand can take a
--webflag to authenticate using a browser. It can also accept authentication token using a
1gh auth login --with-token < myGitHubToken.txt
clonea command allows to omit the current user name and can work with the repository name associated with the logged-in user account:
1gh repo clone RepoName
There are two other official ways to set up a GitHub repository:
node_modules directory is not a part of a cloned repository and should be downloaded using the
npm install command to download all the direct and transitive dependencies mentioned in the
1# make sure that you are in the root directory of the project, use" pwd" or "cd" for windows 2cd RepoName 3npm install
It will take some time to download all the dependencies into a
node_modules directory, and after the download completion, run the project:
node_modulesdirectory can take up more than 200MB, so it should not be a part of a repository.
node_modulesis already a part of a repository then it can be removed using
git rm -r --cached node_modulescommand, though make sure to commit and push the changes to the remote server first.
A GitHub repository can be cloned using
gh tools. Use an SSH key to auto-authenticate. There are many free software available to manage
git projects. Try out the
GitHub CLI tools to bring all the features of the GitHub UI to terminal. Happy coding!