git服务器被删除或变更的处理方法
2017-12-17 21:15
232 查看
误操作删除服务器上git仓库的处理方法
说明:
git 服务器上仓库代码不小心被删除了,但是通过git clone下来的code存在
另外git 服务器上没有建立任何branch信息;
1.在之前clone过服务器代码的客户端机器上,找到clone下来的代码目录,
执行git remote -vv
查询原来git 仓库所在服务器的IP地址以及路径;
2.根据步骤1上查询的结果,在服务器上找到对应路径,创建git仓库;
git init --bare
3.在客户端之前clone 代码所在目录,强制push客户端的代码至服务器
git push origin master --force
这样原来clone下来的代码以及change log等信息,就会被强制clone到服务器上;
说明:此处必须加--force选项,否则会因服务器上仓库信息与客户端仓库信息不匹配导致push失败;
转自:http://blog.csdn.net/hunter168_wang/article/details/73933494
git仓库迁移和更新远程仓库地址的处理方法
一、git仓库迁移
1、从原仓库clone或pull到本地仓库
git clone project_name 【old_remote_repository_address】
2、在新的git创建一个新仓库。如果用gitolite搭建的git服务器,那么只需要在配置文件gitolite.conf上添加仓库和用户,然后push到服务器即可。
3、进入clone下来的本地仓库目录,将远程仓库地址修改为新的远程仓库地址
project_name> git remote remove origin
project_name> git remote add origin【new_remote_repository_address】
4、将本地仓库文件push到新的远程仓库
project_name> gitpush origin master
二、修改远程仓库地址
3种方法,除了上面第3步的修改方法,还有以下两种方法:
1、git remote set-url origin 【new_remote_repository_address】
2、更改.git/config配置文件里的ip地址
转自:http://blog.csdn.net/u013260551/article/details/51317777
说明:
git 服务器上仓库代码不小心被删除了,但是通过git clone下来的code存在
另外git 服务器上没有建立任何branch信息;
1.在之前clone过服务器代码的客户端机器上,找到clone下来的代码目录,
执行git remote -vv
查询原来git 仓库所在服务器的IP地址以及路径;
2.根据步骤1上查询的结果,在服务器上找到对应路径,创建git仓库;
git init --bare
3.在客户端之前clone 代码所在目录,强制push客户端的代码至服务器
git push origin master --force
这样原来clone下来的代码以及change log等信息,就会被强制clone到服务器上;
说明:此处必须加--force选项,否则会因服务器上仓库信息与客户端仓库信息不匹配导致push失败;
转自:http://blog.csdn.net/hunter168_wang/article/details/73933494
git仓库迁移和更新远程仓库地址的处理方法
一、git仓库迁移
1、从原仓库clone或pull到本地仓库
git clone project_name 【old_remote_repository_address】
2、在新的git创建一个新仓库。如果用gitolite搭建的git服务器,那么只需要在配置文件gitolite.conf上添加仓库和用户,然后push到服务器即可。
3、进入clone下来的本地仓库目录,将远程仓库地址修改为新的远程仓库地址
project_name> git remote remove origin
project_name> git remote add origin【new_remote_repository_address】
4、将本地仓库文件push到新的远程仓库
project_name> gitpush origin master
二、修改远程仓库地址
3种方法,除了上面第3步的修改方法,还有以下两种方法:
1、git remote set-url origin 【new_remote_repository_address】
2、更改.git/config配置文件里的ip地址
转自:http://blog.csdn.net/u013260551/article/details/51317777
相关文章推荐
- 误操作删除服务器上git仓库的处理方法
- git am PATCH 失败的处理方法
- Nginx服务器处理相关图片详细方法
- 局域网服务器git服务延迟处理
- ERROR 1045 (28000): Access denied for user 'git'@'localhost' (using password: YES) 的处理方法
- 基于eclipse 的 SVN 重定向的方法 和 ibaits(mybaits)在变更了服务器地址之后需要修改的文件
- Git@OSC 服务器关于 RAID 的一个问题处理
- 服务器性能低下时正确的处理方法
- 使用git命令修改指定的commit提交记录并提交到远程服务器的方法
- Git使用基本方法(从远程服务器获取分支,提交修改)
- git 下载的文件与git上面的文件不相同的处理方法
- git merge失败后处理方法
- Ubuntu,两个服务器之间 复制文件方法(还包括一些基本的数据处理的部分)
- Linux 搭建Git服务器的方法
- linux 服务器搭建git服务器方法
- TortoiseGit 连接 git服务器免输入用户名和密码的方法
- git工程迁移(修改提交服务器地址)方法
- 当git仓库checkout出现文件消失的处理方法