Skip to content

Instantly share code, notes, and snippets.

@AgungPambudi
Last active July 21, 2022 18:15
Show Gist options
  • Save AgungPambudi/d9632c20dc463f2d86a741bb8a43506c to your computer and use it in GitHub Desktop.
Save AgungPambudi/d9632c20dc463f2d86a741bb8a43506c to your computer and use it in GitHub Desktop.
#author : Agung Pambudi
#email : mail@agungpambudi.com
#version : 0.1
#==============================================================================
# _ _ _
# ___ ___ _ _ ___ ___ ___ ___ _____| |_ _ _ _| |_| ___ ___ _____
#| .'| . | | | | . | . | .'| | . | | | . | |_| _| . | |
#|__,|_ |___|_|_|_ | _|__,|_|_|_|___|___|___|_|_|___|___|_|_|_|
# |___| |___|_|
# Initial on Ubuntu Linux
-------------------------
$ git config --list --show-origin
$ git config --global user.name "username anda"
$ git config --global user.email "email anda"
$ ssh-keygen -t rsa -b 4096 -C "email@yourdomain.com"
# Upload ke Github
------------------
$ git init
$ git add .
$ git status
$ git add .gitignore
$ git commit –m "Rilis pertama"
$ git remote add origin https://github.com/AgungPambudi/kuis1_18311052_ci.git
$ git remote show origin
$ git push -u origin main
$ git push origin --force --all
jika sintaks diatas gagal
-------------------------
$ git push -u origin HEAD:<remoteBranch>
contoh :
$ git push -u origin HEAD:master
$ git remote rm https://github.com/AgungPambudi/kuis1_18311052_ci.git
# Update Local Repo (Our Computer)
------------------
$ git pull --rebase origin main
$ git pull "https://github.com/AgungPambudi/kuis1_18311052_ci.git"
# Update Local Repo (Our Computer) from branch "main"
$ git pull origin [nama_cabang]
$ git pull origin main
# Ambil beberapa file di remote github/is-it-possible-to-pull-just-one-file-in-git
----------------------------------------
$ git checkout origin/main -- {filename}
# Melihat semua branch dengan menulis command berikut di command line:
-----------------------------------------------------------------------
$ git branch
# Memindahkan branch/cabang
-----------------------------------------------------------------------
$ git checkout [new_branch]
Start a new git repository
Your first instinct, when you start to do something new, should be git init. You’re starting to write a new paper, you’re writing a bit of code to do a computer simulation, you’re mucking around with some new data … anything: think git init.
A new repo from scratch
Say you’ve just got some data from a collaborator and are about to start exploring it.
1. Create a directory to contain the project.
2. Go into the new directory.
3. Type $ git init.
4. Type $ git add .
5. Type $ git commit
# create a new repository on the command line
echo "# crispdm-agungpambudi-prop" >> README.md
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git branch -M 'main'
$ git remote add origin git@github.com:AgungPambudi/crispdm-agungpambudi-prop.git
$ git push -u origin 'main'
$ ssh-keyscan github.com >> ~/.ssh/known_hosts
$ ssh-keygen -t rsa -C "your_email@youremail.com"
$ ssh-add ~/.ssh/id_rsa_account2
$ ssh-add ~/.ssh/id_rsa_account1
$ cat ~/.ssh/id_rsa.pub
Connect it to github
You’ve now got a local git repository. You can use git locally, like that, if you want. But if you want the thing to have a home on github, do the following.
Go to github.
1. Log in to your account.
2. Click the new repository button in the top-right. You’ll have an option there to initialize the repository with a README file, but I don’t.
3. Click the “Create repository” button.
4. Now, follow the second set of instructions, “Push an existing repository…”
$ git remote add origin git@github.com:AgungPambudi/new_repo
$ git push -u origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment