๐ Introduction
So far, youโve learned the basics of Git and GitHub. But how do you actually connect your local project to GitHub?
Thatโs where Personal Access Tokens (PATs) come in.
GitHub has deprecated password authentication for Git operations, and now recommends using PAT tokens for secure access. In this blog, weโll walk through the entire process of pushing a new project from your computer to GitHub โ step by step.
๐งโ๐ซ Step 1: Configure Git (only once per computer)
Before pushing anything, you need to tell Git who you are. Run these commands in your terminal:
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
git config --global credential.helper store
๐ This sets up your identity and ensures Git can store credentials for future use.
๐งโ๐ซ Step 2: Create a Spring Boot project
For this example, letโs create a demo project using Spring Initializr:
- Go to ๐ https://start.spring.io/
- Select:
- Project: Maven
- Language: Java
- Spring Boot: latest stable
-
Group:
com.example -
Artifact:
demo - (Optional) Add Spring Web dependency
- Click Generate Project โ a
.zipfile will download. - Extract the project and open it in your IDE (IntelliJ IDEA or VS Code).
- Click Generate Project โ a
๐งโ๐ซ Step 3: Create an empty GitHub repository
Next, letโs set up a remote repository on GitHub:
- Log in to ๐ https://github.com.
- Click New Repository.
- Enter repo name โ
spring-demo. - โ ๏ธ Keep the repository empty (donโt add README, .gitignore, or license).
- Click Create Repository.
๐งโ๐ซ Step 4: Generate a PAT (Personal Access Token)
Now we need a PAT to authenticate securely:
- Go to ๐ GitHub Settings โ Developer Settings โ Personal access tokens.
- Click Tokens (classic) โ Generate new token (classic).
- Fill in details:
- Name:
spring-project-token - Expiration: 30 days (or as needed)
- Permissions: โ
repo
- Click Generate token.
- Copy the token (e.g.,
ghp_abc123XYZ...) and save it somewhere safe.
๐งโ๐ซ Step 5: Connect local project to GitHub
Open your terminal inside the Spring project folder and run:
git init
git remote add origin https://github.com/your-username/spring-demo.git
git add .
git commit -m "Initial Spring Boot project"
git branch -M main
git push -u origin main
๐งโ๐ซ Step 6: Authenticate with GitHub
When you run the push command:
- Git will ask for username โ enter your GitHub username.
- Git will ask for password โ paste your PAT token.
๐ Step 7: Verify on GitHub
Finally, go to your repository on GitHub.
You should now see your Spring Boot project uploaded successfully ๐
๐ฏ Conclusion
Thatโs it! Youโve just connected your local Git project to GitHub using a Personal Access Token.
- Git is now configured on your machine.
- Your project is securely stored in GitHub.
- Youโre ready to collaborate with others.
This process is a one-time setup per project โ once done, future pushes will be much simpler.
โ Next Steps
๐ Be interview-ready in the era of AI & Cloud โ start your DevOps journey today!
๐ก YouTube wonโt get you a job. Real projects + real internship certificate will.
๐ฅ AI is reshaping jobs. Donโt watch it happen, be part of it with DevOps & Cloud skills.
๐ฏ โน2000/month today = Dream job tomorrow. Secure your spot now.
โณ Every month you wait, Cloud + AI jobs are being filled. Donโt miss out!
๐ DevOps + AWS + AI = The skillset every recruiter is hunting for in 2025.
๐ Register now at TechEazy Consulting
Top comments (0)