🛠️Git Guide
Cloning a Git Repository Directly into the Current Directory
This guide will demonstrate how to clone the nexus
repository from GitHub directly into the current directory without creating a new project folder.
Prerequisites
Ensure Git is installed on your system. If Git is not installed, follow the installation guide for your operating system provided below.
Steps to Clone the Repository
Open a terminal or command prompt.
Navigate to the directory where you want the project files to be placed.
Ensure the directory is empty, as Git does not allow cloning into a non-empty directory.
Execute the following command:
git clone https://github.com/toowake/nexus.git ./
Connecting to a GitHub Repository and Contributing
This guide will cover how to connect your local folder to your own GitHub repository, make changes, and contribute back to the main repository through a pull request.
Setting Up Your GitHub Repository
Create a New Repository on GitHub
Go to GitHub and sign in to your account.
Navigate to your Repositories page and click the
New
button.Name your repository and set it to public or private as required.
Click
Create repository
.
Connect Your Local Project to Your GitHub Repository
Open your terminal and navigate to your project directory.
Initialize the directory as a Git repository if not already done:
git init
Add the remote repository link to your local repository:
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.git
Verify the new remote URL:
git remote -v
Making Changes and Pushing to GitHub
Add Changes to the Repository
Make necessary changes to your files in the local directory.
Add the changes to Git:
git add .
Commit the changes:
git commit -m "Your commit message"
Push Changes to GitHub
Push your changes using:
git push origin main
If you are prompted for authentication, enter your GitHub username and password.
Opening a Pull Request
Fork the Main Repository
Navigate to the original repository provided (
https://github.com/toowake/nexus
).Click the
Fork
button at the top right of the page to create a copy of the repository in your GitHub account.
Clone Your Fork
Clone the forked repository to your computer:
git clone https://github.com/YOUR_USERNAME/nexus.git
Navigate into the cloned directory:
cd nexus
Create a New Branch
Create and switch to a new branch in your local repository:
git checkout -b feature-branch-name
Make Changes and Commit
Make changes in your local repository as required.
Add and commit those changes:
git add . git commit -m "Detailed description of changes"
Push Your Branch
Push the branch to your GitHub fork:
git push origin feature-branch-name
Open a Pull Request
Go to your repository on GitHub.
You’ll see a
Compare & pull request
button. Click it.You can also go to the "Pull Requests" tab and click the
New pull request
button.Select your fork on the right dropdown list, and the branch you pushed to.
Click
Create pull request
.Add any descriptions of the changes, and when you’re ready, click
Create pull request
again.
This guide provides all the necessary steps to connect your local directory to a new GitHub repository, push changes, and also make contributions back to an original repository through a pull request.
Last updated