apt-get install git-core
Gerando a chave
ssh-keygen -t rsa -C "diegolirio.dl@gmail.com"
Instalando o xclip para realizar copia p/ area de transferencia
sudo apt-get install xclip
Local da chave /home/diego/.ssh/id_rsa.pub
Copiando chave para area de transferencia
xclip -sel clip < id_rsa.pub
Configurando usuario para commits
git connfig --global user.name "Diego Lirio"
git connfig --global user.email "diegolirio.dl@gmail.com"
Iniciar um diretorio
git init
Add arquivo
git add arquivo.java
Add todos os Estagios All
git add -A
Add os estagios novo_arquivo e os modificados, without deleted
git add .
stages modified and deleted, without new
git add -u
Voltar add
git reset
commit, subir para repositorio local
git commit -m "Commit, comentario do commit"
commit, subir todas as alterações, inclusao e exclusão...
git commit -a -m "Commit, comentario do commit"
????? Analisar commando abaixo
git commit --amend -m "se após o comite você notar um erro na mensagem ou esquecido de adicionar algum outro arquivo, experimente comitar com o argumento --amend."
remote - linkar com o repositorio remoto...
git remote add origin git@bitbucket.org:diegolirio/MenuTdvWeb.git
Para trabalhar com dois remote ao mesmo tempo, Add um outro remote.
git remote add github git@github.com:diegolirio/MenuTdvWeb.git
Alterar origin do remote
git remote set-url origin git://bitbucket.org/asisco/MenuTdvWeb.git
------- (erro: nao consegui se conectar com servidor remoto com esse comando ---> )
git remote set-url origin git://github.com/CaioProiete/MenuTdvWeb.git
Visualizar repositorio remoto que estou apontando. (Ex: no caso o origin aponto para o git@bitbucket.org:diegolirio/exemplo.git)
git remote show origin
Se no caso add um outro remote apontando para um outro servidor remoto (Ex: no caso o 'github' aponto para o git@github.com:diegolirio/exemplo.git)
git remote show github
ver remotes cadastrados
git remote -v
remover da lista de remote
git remote rm github
para realizar o commit para o repositorio remoto (Atualizar repositorio remoto de acordo c/ o seu repositorio local)
git push -u origin master
subir para repositorio remoto
git push origin master
git push github master
atualizar, repositorio Local de acordo com o remoto
git pull
atualizar indicando o repositorio
git pull origin master
git pull github master
copiar um projeto remoto para repositorio local (baixar)
git clone git@github.com:diegolirio/MenuTdvWeb.git
BRANCH Trabalhando com branch (criando um branch local)
git branch working
Mudar o Head para o branch criado
git checkout working
Criar branch e mudar para ele ao criar
git checkout -b working
Criar branch e mudar para ele ao criar
git checkout -b working
Criar no servidor EX: github.com Após alguma alteração e dado um commit no branch working basta fazer:
git push origin working
Merge Simples Após alterar voltar para o master e realizar o merge
git checkout master
git merge working
Para remover um branch local você faz
git branch -d working
Se quiser que essa remoção se reproduza no remoto faça:
git push origin :working
Se quiser apagar o branch remoto do github sem ter o branch localmente instalado faça:
git push origin --delete working
Se quiser renomear um branch local faça:
git branch -m working new_working
==================================================
Para criar uma TAG chamada FRG83-R002 no commit atual execute:
git tag FRG83-R002
Para criar uma TAG chamada FRG83-R001 no commit 4b8ef995de6d77 execute:
git tag FRG83-R001 4b8ef995de6d77
Para submete-la para o servidor execute:
git push --tags origin master
Para deletar uma TAG execute:
git tag -d FRG83-R001
git push origin :refs/tags/FRG83-R001
Para voce mover para o commit da TAG execute:
git checkout FRG83-R001
Deletar todas as Tags no Server
git push --delete origin $(git tag --list)
############################################################
mais exemplos
- Install and configure the necessary dependencies
If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server and configure it as an SMTP server. On CentOS, the commands below will also open HTTP and SSH access in the system firewall.
sudo apt-get install curl openssh-server ca-certificates postfix
- Add the GitLab package server and install the package
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using
dpkg -i gitlab-ce-XXX.deb
- Configure and start GitLab
sudo gitlab-ctl reconfigure
- Browse to the hostname and login
On your first visit, you'll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you'll be redirected back to the login screen.
The default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish.
- Change Domain Name
Edit the /etc/gitlab/gitlab.rb file,external_url
with your new domain name or IP, and runsudo gitlab-ctl reconfigure