天天看点

gitcode命令指引Git 全局设置创建一个新仓库推送现有文件夹推送现有的 Git 仓库总结

目录

  • Git 全局设置
  • 创建一个新仓库
  • 推送现有文件夹
  • 推送现有的 Git 仓库
  • 总结

Git 全局设置

git config --global user.name "yourname"
git config --global user.email "[email protected]"
           

创建一个新仓库

git clone [email protected]:your_organization/project.git
cd project
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
           

推送现有文件夹

cd existing_folder
git init
git remote add origin [email protected]:your_organization/project.git
git add .
git commit -m "Initial commit"
git push -u origin master
           

推送现有的 Git 仓库

cd existing_repo
git remote rename origin old-origin
git remote add origin [email protected]:your_organization/project.git
git push -u origin --all
git push -u origin --tags
           

总结

根据不同的现实情况选择

继续阅读