赞
踩
有时候我们回滚项目代码后,常常将本地回滚的分支提交到远程分支,命令如下:
1.建立本地仓库
查看当前项目根目录中有没有 .git文件(隐藏文件),如果没有,右键->Git bash here ,然后输入命令git init建立本地仓库
git init
2.将代码提交到本地仓库
git add .
git commit -m "new branch commit"
3.在本地仓库中建立一个与远程仓库的别名,以便之后提交代码而不是每次都要输入远程仓库地址。指令结尾是git的仓库地址,我使用的是SSH连接方式
git remote add origin git@XX.XX.XX.12:gyjia/hotcodeserver.git
使用SSH的话,提交会出现以下问题:
git@gitee.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
所以需要声明公钥:
1)、重新生成ssh
ssh-keygen -t rsa -C “xxxxx@xxxxx.com” (你的账号)
2)、查看你的 public key
cat ~/.ssh/id_rsa.pub
(以ssh-rsa 开头,以账号的注册邮箱结尾的)
3&#x
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。