1 本地创建一个新的Test工程

2 打开GitHub,登录自己的账号,新建一个Test仓库


3 打开终端,使用
git init
初始化仓库,再使用 git add .
命令添加代码,然后使用 git commit -m 'xxx'
命令将代码提到本地仓库。

4 使用
git remote
命令查看是否有与远程仓库关联,看下方截图可知此时没有和任何仓库关联
5 使用
git remote add orgin https://github.com/xxx/Test.git
建立关联关系
6 使用
git push orgin main
命令,将代码推到仓库,如果过长时间没有上传代码到git,可能遇到这个问题
Support for password authentication was removed on August 13, 2021,即git不使用密码登录,而改用了token,可以去setting里面设置token,然后使用
git remote set-url orgin https://<your_token>@github.com/<USERNAME>/<REPO>.git
去设置一下,再次push
git远程

7 此时可以通过打tag的方式创建release包,即pod下来的代码
git tag -a '0.0.1' -m '打tag'
创建本地tag,通过 git tag
命令,可以查看此时所有的tag
使用命令
git push orgin --tags
将tag送到远端



我们也可以通过如下命令
git push orgin 0.0.2
,推送tag到远端
在push过程中有可能会遇到下面的错误,如果确定自己没有开启代理,那就重新走一遍命令,我通过尝试网上的解决方案,发现应该是网络问题导致的

使用
git log
查看tag情况
8 如果此时想要删除一个tag,可以使用命令
git tag -d 0.0.1
删除本地tag
使用
git push orgin :0.0.1
删除远程tag

一份本地创建工程上传到Github就完成了!
网友评论