Skip to content

thanhtruongphan/git-and-Github-using

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 

Repository files navigation

git-and-Github-using image

How to add a new project into Github using VSCode

Navigate to your project directory

cd /path/to/your/project

Initialize a new Git repository

git init
git add .
# Commit with a descriptive message
git commit -m "Initial commit: Describe your project or changes"

Or, if you want to add specific files

git add filename1 filename2

Go to GitHub and create a new repository

Copy the repository URL (use HTTPS or SSH)

Add the remote repository

git remote add origin https://github.com/yourusername/your-repo-name.git

For the first push to main branch

git push -u origin main

For subsequent pushes

git push

Additional Tips:

Create a .gitignore file to exclude unnecessary files:

# Create .gitignore in project root
touch .gitignore

# Example contents to ignore
node_modules/
.env
*.log

Common Troubleshooting:

If you're using the default branch name master instead of main:

git push -u origin master

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published