美文网首页
macos(4)之git本地项目初始化并提交远程仓库

macos(4)之git本地项目初始化并提交远程仓库

作者: feecool | 来源:发表于2018-11-06 20:26 被阅读0次

1、先在远程仓库(如github)创建项目,为了避免错误,不要初始化 README, license, 或者gitignore文件 .

2、打开Terminal终端

3、切换到你的本地项目目录

4、初始化本地仓库

git init

5、添加文件到本地仓库

git add .

# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.

6、提交文件

git commit -m "First commit"

# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.

7、到远程仓库的页面上,复制仓库地址 (笔者以配置好ssh,故复制ssh形式的仓库地址)

8、添加远程仓库地址到本地仓库

git remote add origin {远程仓库地址}

# Sets the new remote

git remote -v

# Verifies the new remote URL

9、push到远程仓库

git push -u origin master

# Pushes the changes in your local repository up to the remote repository you

相关文章

  • Git常用命令笔记

    git命令使用 1 创建远程仓库(初始化--提交到本地仓库--提交到远程仓库) $ git init ...

  • git命令

    将本地新建的项目提交到远程仓库的步骤 初始化本地仓库git init 将本地内容添加至git本地暂存区中git a...

  • 在Linux上部署Laravel遇到的问题

    一、把本地项目上传到git远程仓库 1.初始化项目 2.文件添加到版本库 3.文件提交到仓库 4.关联远程仓库 5...

  • 日常用的git提交代码的方法

    日常用的git提交代码的方法 一、初始化本地仓库,提交代码,提交到远程git仓库 1、初始化代码仓库 git in...

  • git从入门到精通

    查看git命令 初始化git仓库 克隆远程仓库(github) 添加新增的文件 提交到本地库 提交到远程maste...

  • 新建GitHub项目传到GitHub

    1.创建远程仓库 2.创建完成, 4,初始化项目 git init 5,设置本地仓库的远程仓库 git rem...

  • 终端命令

    git命令: 1.初始化本地仓库 2.本地仓库与远程仓库关联 3.将代码提交到本地仓库 4.提交到本地时添加版本信...

  • 初始化项目

    从初始化到提交到远程仓库 #初始化本地仓库git init #将本地内容添加至git索引中git add . #将...

  • 本地项目关联远程Git仓库

    步骤 本地项目初始化 git 关联远程仓库 提交暂存 提交到分支 推送 移除 git 常见问题 如何配置邮箱和用户...

  • 本地代码提交到git

    1.找到本地目录初始化git 2.添加远程地址仓库 3.添加提交代码 4.提交到本地master 5.同步到远程仓库

网友评论

      本文标题:macos(4)之git本地项目初始化并提交远程仓库

      本文链接:https://www.haomeiwen.com/subject/bpgafftx.html