𝗟𝗼𝗰𝗮𝗹 𝗠𝗮𝗰𝗵𝗶𝗻𝗲 𝘁𝗼 𝗚𝗶𝘁𝗛𝘂𝗯 𝗥𝗲𝗽𝗼
Version control is a core skill for developers and DevOps engineers. It helps you track changes and work with others. Git manages your local files. GitHub hosts them in the cloud.
Follow these steps to move your code from your computer to GitHub.
Prepare your workspace Install Git Bash to use a terminal on Windows. This gives you a Linux-like environment. Download it here: https://git-scm.com/downloads
Set your identity Tell Git who you are so your work has a name.
- Set your name: git config --global user.name "Your Name"
- Set your email: git config --global user.email "your-email@example.com"
- Start a local repository Create a folder for your project and turn it into a Git repo.
- Create folder: mkdir website
- Enter folder: cd website
- Start Git: git init
- Create and edit files Create an index.html file and use the Vim editor to add content.
- Create file: touch index.html
- Open Vim: vi index.html
- To type: Press 'i'
- To save and exit: Press 'ESC', then type ':wq' and press Enter
- Save your progress Stage your files and create a snapshot.
- Stage file: git add index.html
- Commit changes: git commit -m "Create index.html"
- Connect to GitHub Link your local folder to a remote GitHub repository.
- Add remote: git remote add origin https://github.com/your-username/your-repo.git
- Push your code Send your local work to the cloud.
- Push code: git push origin main
- Host your site Use GitHub Pages to make your website live.
- Go to Settings > Pages in your GitHub repo.
- Select your branch and save.
- Automate with CI/CD Use GitHub Actions to deploy your code automatically.
- Create workflow folder: mkdir -p .github/workflows
- Create config file: touch .github/workflows/deploy.yml
Mastering these steps builds a foundation for automation and professional software engineering.
Source: https://dev.to/lotanna_obianefo/local-machine-to-github-repo-529c
Optional learning community: https://t.me/GyaanSetuAi