Command line instructions
You can also upload existing files from your computer using the instructions below.
Git global setup
git config --global user.name "Administrator"
git config --global user.email "admin@example.com"
Create a new repository
创建一个新的仓库
git clone git@120.48.46.122:learning/git-demo.git
cd git-demo
git switch -c main
touch README.md
git add README.md
git commit -m "add README"
git push -u origin main
Push an existing folder
推送一个已有的文件夹(把该文件夹的东西初始化仓库)
cd existing_folder
git init --initial-branch=main
git remote add origin git@120.48.46.122:learning/git-demo.git
git add .
git commit -m "Initial commit"
git push -u origin main
Push an existing Git repository
推送一个已有的git仓库
cd existing_repo
git remote rename origin old-origin
git remote add origin git@120.48.46.122:learning/git-demo.git
git push -u origin --all
git push -u origin --tags
网友评论