Start a new git repository (2024)

Your first instinct, when you start to do something new, should begit init. You’re starting to write a new paper, you’re writing abit of code to do a computer simulation, you’re mucking around with somenew data … anything: think git init.

A new repo from scratch

Say you’ve just got some data from a collaborator and are about tostart exploring it.

  • Create a directory to contain the project.
  • Go into the new directory.
  • Type git init.
  • Write some code.
  • Type git add to add the files (see thetypical use page).
  • Type git commit.

The first file to create (and add and commit) is probably a ReadMefile, either as plain text or withMarkdown, describingthe project.

Markdown allows you to add a bit of text markup, likehyperlinks,bold/italics, or to indicate code with a monospacefont. Markdown is easily converted to html for viewing in a webbrowser, and GitHub will do this for you automatically.

A new repo from an existing project

Say you’ve got an existing project that you want to start trackingwith git.

  • Go into the directory containing the project.
  • Type git init.
  • Type git add to add all of the relevant files.
  • You’ll probably want to create a .gitignore file right away, toindicate all of the files you don’t want to track. Use git add.gitignore, too.
  • Type git commit.

Connect it to github

You’ve now got a local git repository. You can use git locally, likethat, if you want. But if you want the thing to have a home on github, dothe following.

  • Go to github.
  • Log in to your account.
  • Click the new repository button in thetop-right. You’ll have an option there to initialize the repository with a READMEfile, but I don’t.
  • Click the “Create repository” button.

Now, follow the second set of instructions, “Push an existingrepository…”

$ git remote add origin git@github.com:username/new_repo$ git push -u origin master

Actually, the first line of the instructions will say

$ git remote add origin https://github.com/username/new_repo

But I use git@github.com:username/new_repo rather than https://github.com/username/new_repo, as theformer is for use withssh (if you set up ssh asI mentioned in “Your first time”, then you won’thave to type your password every time you push things to github). Ifyou use the latter construction, you’ll have to type your githubpassword every time you push to github.

Next: Contribute to someone’s repository

Start a new git repository (2024)
Top Articles
SGOV Dividend History, Dates & Yield - Stock Analysis
People with an ISA warned 'loophole' will be closed from April 5
Mcgeorge Academic Calendar
Manhattan Prep Lsat Forum
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Big Spring Skip The Games
Google Jobs Denver
Costco in Hawthorne (14501 Hindry Ave)
Bbc 5Live Schedule
Florida (FL) Powerball - Winning Numbers & Results
Brenna Percy Reddit
Craigslist Dog Kennels For Sale
Www.paystubportal.com/7-11 Login
Mission Impossible 7 Showtimes Near Regal Bridgeport Village
Buying risk?
Med First James City
5808 W 110Th St Overland Park Ks 66211 Directions
Morocco Forum Tripadvisor
This Modern World Daily Kos
Dc Gas Login
Pac Man Deviantart
Unlv Mid Semester Classes
Bridge.trihealth
Schedule 360 Albertsons
Axe Throwing Milford Nh
U Of Arizona Phonebook
PCM.daily - Discussion Forum: Classique du Grand Duché
kvoa.com | News 4 Tucson
Boise Craigslist Cars And Trucks - By Owner
The Banshees Of Inisherin Showtimes Near Broadway Metro
Craigslist Ludington Michigan
Xpanas Indo
Maisons près d'une ville - Štanga - Location de vacances à proximité d'une ville - Štanga | Résultats 201
Mobile crane from the Netherlands, used mobile crane for sale from the Netherlands
Progressbook Newark
Hoofdletters voor God in de NBV21 - Bijbelblog
Mrstryst
Ket2 Schedule
Chs.mywork
Jail View Sumter
Wayne State Academica Login
Riverton Wyoming Craigslist
Best Restaurants Minocqua
814-747-6702
Paul Shelesh
What to Do at The 2024 Charlotte International Arts Festival | Queen City Nerve
Woody Folsom Overflow Inventory
10 Types of Funeral Services, Ceremonies, and Events » US Urns Online
Join MileSplit to get access to the latest news, films, and events!
Gelato 47 Allbud
Makes A Successful Catch Maybe Crossword Clue
Yoshidakins
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6150

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.