To upload and download files to/from GitHub using Linux command line, you'll need to use Git, a
version control system. Here's a step-by-step guide:
**Prerequisites**
* Install Git on your Linux system if you haven't already: `sudo apt-get install git` (for Ubuntu-based
systems) or `sudo yum install git` (for RHEL-based systems).
* Create a GitHub account and set up a new repository.
* Generate a SSH key pair on your Linux system: `ssh-keygen -t rsa -b 4096` (follow the prompts to
create a key pair).
* Add the public key to your GitHub account: Go to your GitHub account settings > SSH and GPG keys
> New SSH key > paste the contents of the `~/.ssh/id_rsa.pub` file.
**Upload files to GitHub**
1. **Initialize a Git repository**: Navigate to the directory containing the files you want to upload
and run `git init`.
2. **Add files to the repository**: Run `git add <file_name>` to stage the files you want to upload.
You can also use `git add .` to stage all files in the directory.
3. **Commit changes**: Run `git commit -m "Initial commit"` to commit the changes with a
meaningful message.
4. **Link your local repository to GitHub**: Run `git remote add origin
https://github.com/your_username/your_repo_name.git` (replace with your GitHub repository
URL).
5. **Push changes to GitHub**: Run `git push -u origin master` to upload the files to your GitHub
repository.
**Download files from GitHub**
1. **Clone the repository**: Run `git clone
https://github.com/your_username/your_repo_name.git` (replace with your GitHub repository URL)
to download the entire repository.
2. **Pull changes from GitHub**: If you've already cloned the repository, run `git pull origin master`
to download the latest changes.
**Additional Git commands**
* `git status`: Check the status of your repository.
* `git log`: View the commit history.
* `git branch`: List, create, or delete branches.
* `git merge`: Merge changes from another branch.
* `git reset`: Reset changes to a previous commit.
**Tips**
* Use `git config --global user.name "Your Name"` and `git config --global user.email
"[email protected]"` to set your Git username and email.
* Use `git config --global credential.helper store` to store your GitHub credentials securely.
* Use `git push --set-upstream origin master` to set the upstream tracking information for the first
time.
By following these steps, you can easily upload and download files to/from GitHub using Linux
command line.