코린이의 기록

[git] Bitbucket 최초 사용하기 (Repository만들고 Code Push하기) 본문

ICT&Tools/Git

[git] Bitbucket 최초 사용하기 (Repository만들고 Code Push하기)

코린이예요 2019. 7. 11. 10:47
반응형

우선 Bitbucket에서 Create repository를 생성한다

Configure Git for the first time

사용자 정보를 먼저 설정한다. 

이름과 이메일 주소를 설정해준다. Commit시 사용되기 때문

git config --global user.name "[user name]" 
git config --global user.email "[user email]"

ex.

# git config --globlal user.name "test"

# git config -- global user.eimail "test@google.com" 

 

Working with your repository

I just want to clone this repository

If you want to simply clone this empty repository then run this command in your terminal.

git clone https://bitbucket.test.com/scm/~test/test.git

My code is ready to be pushed

If you already have code ready to be pushed to this repository then run this in your terminal.

cd existing-project
git init
git add --all
git commit -m "Initial Commit"
git remote add origin https://bitbucket.test.com/scm/~test/test.git
git push -u origin master

git push를 하면 Bitbucket username과 passworkd를 입력한다.

 

Result

Username for 'https://bitbucket.test.com': test 
Password for 'https://test@bitbucket.test.com': 
Counting objects: 904, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (268/268), done. 
Writing objects: 100% (904/904), 10.07 MiB | 0 bytes/s, done. 
Total 904 (delta 629), reused 904 (delta 629) 
remote: Resolving deltas: 100% (629/629), done. 
To https://bitbucket.alticast.com/scm/~test/test.git 
 * [new branch]      master -> master 
Branch master set up to track remote branch master from orgin. 

My code is already tracked by Git

If your code is already tracked by Git then set this repository as your "origin" to push to.

cd existing-project
git remote set-url origin https://bitbucket.test.com/scm/~test/test.git
git push -u origin --all
git push origin --tags

 

반응형

'ICT&Tools > Git' 카테고리의 다른 글

[GIT] git INIT Command line instructions  (0) 2019.12.26
Comments