Git 本地代码提交到远程仓库,已有仓库更改远端仓库地址并提交

Configure Git for the first time
git config --global user.name ""
git config --global user.email ""

Working with your repository
I just want to clone this repository
If you want to simply clone this empty repository then run this command in your terminal.

git clone https://*/usermanagement.git
My code is ready to be pushed
If you already have code ready to be pushed to this repository then run this in your terminal.

cd existing-project
git init
git add --all
git commit -m "Initial Commit"
git remote add origin https://*/usermanagement.git
git push -u origin HEAD:master
My code is already tracked by Git
If your code is already tracked by Git then set this repository as your "origin" to push to.

cd existing-project
git remote set-url origin https://*/usermanagement.git
git push -u origin --all
git push origin --tags

posted @ 2022-04-22 11:26  小老弟1999  阅读(292)  评论(0编辑  收藏  举报