Upload local projects to Github repository or Gitee repository

Github:

Initialization will automatically generate a .git folder locally

git init

The git add  command can add the file to the staging area.

Add one or more files to the staging area:

git add [file1] [file2] ...

 Add the specified directory to the staging area, including subdirectories:

git add [dir]

Add all files in the current directory to the temporary storage area:

git add .

Descriptive information must be written

git commit -m "描述信息"

rename current branch

git branch -M main

Associate a remote warehouse with a local warehouse

git remote add origin https://github.com/xxx.git

Push the commits of the local branch to the remote repository

git push -u origin main

If the submission fails, you can try to force push the submission of the local branch to the remote warehouse

git push -f origin main

Gitee:

Initialization will automatically generate a .git folder locally

git init

The git add  command can add the file to the staging area.

Add one or more files to the staging area:

git add [file1] [file2] ...

 Add the specified directory to the staging area, including subdirectories:

git add [dir]

Add all files in the current directory to the temporary storage area:

git add .

Descriptive information must be written

git commit -m "描述信息"

Associate a remote warehouse with a local warehouse

git remote add origin https://gitee.com/xxx.git

Push the commits of the local branch to the remote repository

git push -u origin "master"

If the submission fails, you can try to force push the submission of the local branch to the remote warehouse

git push -f origin "master"

Guess you like

Origin blog.csdn.net/love906897406/article/details/130795010