Introduction
Bitbucket is like Github. Which one should I use? Both GitHub and Bitbucket offer great Git services, but each has its own features and pricing plans.Answer, use both. Use GitHub for open source and public repos and Bitbucket for private repos.
Interface
Bitbucket dashboard |
Github dashboard |
$ sudo apt-get install git
Step 1: Check for SSH keys
First, we need to check for existing SSH keys on your computer. Open up your Terminal and type:
ls -al ~/.ssh # Lists the files in your .ssh directory, if they exist
Check the directory listing to see if you already have a public SSH key. The default public key file names are:
- id_dsa.pub
- id_ecdsa.pub
- id_ed25519.pub
- id_rsa.pub
To generate a new SSH key, copy and paste the text below, making sure to substitute in your email address. The default settings are preferred, so when you're prompted to "Enter a file in which to save the key", just press Enter to continue.
ssh-keygen -t rsa -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair. # Enter file in which to save the key (/home/you/.ssh/id_rsa):
Next, you'll be asked to enter a passphrase.
# Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again]
Which should give you something like this:
# Your identification has been saved in /home/you/.ssh/id_rsa. # Your public key has been saved in /home/you/.ssh/id_rsa.pub. # The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
sudo apt-get install xclip
Copy your ssh keyxclip -sel clip < ~/.ssh/id_rsa.pub
Enter it to Bitbucket page.
Then configure your Git repo.
Create folder
$mkdir code
$cd code
$git init
$git config --global user.email "yourmail"
$git config --global user.name "yourname"
Then add your repository
$git remote add origin git@bitbucket.org:yourname/repo.git
Add all files to git in your local repo. Then commit changes.
$git add .
$git commit -m "testing git"
Push files to Bitbucket
$git push -u origin master
If you somewhere encounter problem "fatal remote origin exists" set it again with command:
git remote set-url origin git://new.url.here
Ei kommentteja:
Lähetä kommentti