ssh免密码,git拉取和上传代码,时间同步

ssh免密码:
建立密钥
ssh-keygen -t rsa
一直回车node

复制公钥要指定IP地址
ssh-copy-id -i .ssh/id_rsa.pub root@192.168.254.135
输入密码git

测试
ssh root@192.168.254.135服务器

git拉取和上传代码:
下载相应的应用目录及文件
git clone git@node.abc.com:root/test.git
更新数据包(拉取数据)
cd 到相应目录
git pull
git statusssh

初始化本地git目录、并添加远程仓库
git init
git remote add origin git@node.abc.com:root/test.git
上传代码
git status
git add .
git commit -m "x" 删除
git commit -m "add new feile" 新增
git pull 拉取
git push 推送ide

git commit -m 'update'
git push origin master测试

上传文件
进入到项目目录
cd test/
建立须要上传到GitLab中的目标文件
echo “test” > /root/test.sh
将目标文件或者目录拷贝到项目目录下
cp /root/test.sh ./
将test.sh文件加入到索引中
git add test.sh
将test.sh提交到本地仓库
git commit -m “test.sh”
将文件同步到GitLab服务器上
git push -u origin master 索引

时间同步:
yum -y install ntp
定时任务
每小时同步一次
crontab -ecrontab

  • 1 * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1systemctl start ntpd
相关文章
相关标签/搜索