How to upload a folder to github

ls  /tmp
project1  project2  project3  project4  

I want to upload project1 and its folders and files to github.

if you do so

cd / tmp/project1
git init
git add.
git commit-m "upload"
git remote add origin https://github.com/xxxx/mygit.
git push-u origin master-f

all the files in project1 are uploaded, but they are not wrapped by project1.

if
cd / tmp
git init
git add.
git commit-m "upload"
git remote add origin

Mar.18,2021

two methods:

< hr >

1. Remember git add * * you can choose which one to add to the resource to upload, so you can just add the project1 directory

.

2. For a simple and rude method, create a .gitignore file under the / tmp directory, write down the folders that cannot be uploaded, and then use it normally

.

the easiest way to pull a branch from github to local, and put the file to be uploaded to github into this branch file anywhere and execute the git command


directly git add project1/ is fine

Menu