Difference between revisions of "VScaler: Using Bitbucket Repository"

From Define Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 118: Line 118:
 
To git@bitbucket.org:bostonhpc/vscaler-openhpc.git
 
To git@bitbucket.org:bostonhpc/vscaler-openhpc.git
 
   4081752..f18e72f  jon-test -> jon-test
 
   4081752..f18e72f  jon-test -> jon-test
 +
</syntaxhighlight>
 +
 +
 +
== Quick Notes on setting up new systems ==
 +
<syntaxhighlight>
 +
# Add ssh keys to the bitbucket a/c: Profile (Top Right) -> Bitbucket Settings -> LHS Security -> SSH Keys
 +
# If you have multiple ssh keys on system, like an openHPC head; then
 +
[root@mitaka-head ~]# ssh-agent bash
 +
[root@mitaka-head ~]# ssh-add ~/.ssh/id_rsa
 +
Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
 +
[root@mitaka-head ~]# git clone git@bitbucket.org:bostonhpc/vscaler-openhpc.git
 +
Cloning into 'vscaler-openhpc'...
 +
remote: Counting objects: 443, done.
 +
remote: Compressing objects: 100% (396/396), done.
 +
remote: Total 443 (delta 153), reused 0 (delta 0)
 +
Receiving objects: 100% (443/443), 705.97 KiB | 0 bytes/s, done.
 +
Resolving deltas: 100% (153/153), done.
 +
[root@mitaka-head ~]# cd vscaler-openhpc/
 +
[root@mitaka-head vscaler-openhpc]# git fetch && git checkout Dave_Ansible
 +
From bitbucket.org:bostonhpc/vscaler-openhpc
 +
* [new branch]      Dave_Ansible -> origin/Dave_Ansible
 +
Branch Dave_Ansible set up to track remote branch Dave_Ansible from origin.
 +
Switched to a new branch 'Dave_Ansible'
 +
 +
# Otherwise
 +
 +
git config --global user.name "David Power"
 +
git config --global user.email "David.Power@vScaler.com"
 +
git config --global push.default simple
 +
git clone git@bitbucket.org:bostonhpc/vscaler-openhpc.git
 +
# do some stuff
 +
git status
 +
git add --all
 +
git commit -am "Comment here"
 +
git status
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 09:21, 31 March 2017

Cloning main repo

  • Use the git clone command
Jons-MacBook:vScaler-scripts Jon$ pwd
/Users/Jon/Work/vScaler-scripts
Jons-MacBook:vScaler-scripts Jon$ git clone git@bitbucket.org:bostonhpc/vscaler-openhpc.git
Cloning into 'vscaler-openhpc'...
remote: Counting objects: 130, done.
remote: Compressing objects: 100% (100/100), done.
remote: Total 130 (delta 25), reused 0 (delta 0)
Receiving objects: 100% (130/130), 22.87 KiB | 0 bytes/s, done.
Resolving deltas: 100% (25/25), done.
Checking connectivity... done.

Pull down latest info from a branch or master

  • Use the git pull command
Jons-MacBook:vscaler-openhpc Jon$ git pull
Already up-to-date.

Identify available and currently selected branch

  • Use the git branch command
Jons-MacBook:vscaler-openhpc Jon$ git branch
* jon-test
  master

Switch to different branch

  • Switch to the top level directory for the local copy of your repo
  • Use the following commands:
    • git fetch to download objects and refs from another repository.
    • git checkout <branch_name> to switch to another branch (and specify the branch name)
Jons-MacBook:vScaler-scripts Jon$ cd vscaler-openhpc/
Jons-MacBook:vscaler-openhpc Jon$ git fetch && git checkout jon-test
Branch jon-test set up to track remote branch jon-test from origin.
Switched to a new branch 'jon-test'

Identify changes

  • Use the git status command
Jons-MacBook:python Jon$ git status
On branch jon-test
Your branch is up-to-date with 'origin/jon-test'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	hello.txt

nothing added to commit but untracked files present (use "git add" to track)

Add a modified file to your local index

  • Use the git add <filename> command
Jons-MacBook:python Jon$ git add hello.txt
  • And confirm with git status
Jons-MacBook:python Jon$ git status
On branch jon-test
Your branch is up-to-date with 'origin/jon-test'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	new file:   hello.txt

Commit modifications

  • Use the git commit command with -am option and add a message
Jons-MacBook:python Jon$ git commit -am "Added a test file"
[jon-test 6579eaf] Added a test file
 Committer: Jonathan Howard <Jon@Jons-MacBook.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 openhpc-installer/python/hello.txt
  • Confirm with git status
Jons-MacBook:python Jon$ git status
On branch jon-test
Your branch is ahead of 'origin/jon-test' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

Push commits back to web based repo

  • Use git push origin <branch> command
Jons-MacBook:python Jon$ git push origin jon-test
Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 818 bytes | 0 bytes/s, done.
Total 8 (delta 2), reused 0 (delta 0)
remote: 
remote: Create pull request for jon-test:
remote:   https://bitbucket.org/bostonhpc/vscaler-openhpc/pull-requests/new?source=jon-test&t=1
remote: 
To git@bitbucket.org:bostonhpc/vscaler-openhpc.git
   4081752..f18e72f  jon-test -> jon-test


Quick Notes on setting up new systems

# Add ssh keys to the bitbucket a/c: Profile (Top Right) -> Bitbucket Settings -> LHS Security -> SSH Keys
# If you have multiple ssh keys on system, like an openHPC head; then
[root@mitaka-head ~]# ssh-agent bash
[root@mitaka-head ~]# ssh-add ~/.ssh/id_rsa
Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
[root@mitaka-head ~]# git clone git@bitbucket.org:bostonhpc/vscaler-openhpc.git
Cloning into 'vscaler-openhpc'...
remote: Counting objects: 443, done.
remote: Compressing objects: 100% (396/396), done.
remote: Total 443 (delta 153), reused 0 (delta 0)
Receiving objects: 100% (443/443), 705.97 KiB | 0 bytes/s, done.
Resolving deltas: 100% (153/153), done.
[root@mitaka-head ~]# cd vscaler-openhpc/
[root@mitaka-head vscaler-openhpc]# git fetch && git checkout Dave_Ansible
From bitbucket.org:bostonhpc/vscaler-openhpc
 * [new branch]      Dave_Ansible -> origin/Dave_Ansible
Branch Dave_Ansible set up to track remote branch Dave_Ansible from origin.
Switched to a new branch 'Dave_Ansible'

# Otherwise

git config --global user.name "David Power"
git config --global user.email "David.Power@vScaler.com"
git config --global push.default simple
git clone git@bitbucket.org:bostonhpc/vscaler-openhpc.git
# do some stuff
git status
git add --all
git commit -am "Comment here" 
git status