从github上git clone 别人的项目,在自己的gitlab上建立一个同样的项目。
用到下面几个命令:
先创建ssh key
ssh-keygen
一路回车
cat id_rsa.pub
git remote add dv git@10.0.3.201:develop2/wayne.git
#git fetch dv 有时会失败
git pull dv
git checkout -b master dv/master
git merge origin/release/v1.6 --allow-unrelated-histories
或者 git merge v1.6 --allow-unrelated-histories
git push
git fetch 报错“fatal: Could not read from remote repository.”
使用以下命令处理:
git remote add dvl git@10.0.3.201:develop2/wayne.git
git fetch dvl
成功
结果我们看到
v1.6是github上的分支历史记录,develop是我们自己的gitlab上的分支。
报错
um$ git pull aaaa
You asked to pull from the remote 'aaaa', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
test@ubuntu:~/gopath/src/pomerium$ ls
报上边的错误,是需要在自己的git 分支上 添加一个文件 即可.
其他命令
强制恢复,慎用
git reset --hard
git push origin develop:qianduan