Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git操作方法 #5

Open
deepthan opened this issue Jan 1, 2018 · 0 comments
Open

git操作方法 #5

deepthan opened this issue Jan 1, 2018 · 0 comments

Comments

@deepthan
Copy link
Owner

deepthan commented Jan 1, 2018

1. 本地项目上传到gitlab上指定项目地址

在项目里面打开点击右键 git bash here

//通过命令把这个目录变成git可以管理的仓库:
git init 

//关联到远程库,这里的远程仓库选择Clone with HTTPS的地址。
git remote add origin https://github.com/deepthan/Angular-demo.git

//把文件添加到版本库中,添加到暂存区里面去,不要忘记后面的小数点“.”,意为添加文件夹下的所有文件
git add .

//告诉Git,把文件提交到本地仓库。引号内为提交说明
git commit -m 'creat project'

//拉取文件合并冲突
git pull  https://github.com/deepthan/Angular-demo.git master

// 本地库的内容推送到远程
git push origin master


注意: 如果推送到远程报错了说明你本地有文件,就先拉在推,再合并冲突并提交到本地,再推送到远程

git pull  https://github.com/deepthan/Angular-demo.git master
// 再处理 本地冲突文件
git commit -m 'creat project'
git push origin master

2. 提交到不到github 上

因为你的本地仓库没有和github关联起来。

  1. 找到 .ssh文件夹,打开 id_rsa.pub文件并复制里面的数据
  2. 登录github,点击setting ,再点击SSH and GPG keys,再点击 New SSH key, 标题可以随意起,把前面复制的内容填到key框里保存即可。

3. 查看相关信息

查看git的服务器地址:

git remote -v 

看项目是从git的那个分支上拉下来的:

git remote show origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant