How to push a new project to GitHub

how-to-push-a-new-project-to-github

If you’ve never used Git or GitHub before, you need to understand one of the most important tasks you’ll use with the service: How to push a new project to a remote repository.

Image: Jack Wallen

GitHub is one of the most widely-used software repositories for the Git Version Control system. With GitHub, you can create new repositories, share those repositories, and collaborate with teams on projects.

For every developer, one of the most important things you can do is interact with GitHub from the command line. By doing this, you can create an empty repository on GitHub and then connect a local repository to that remote. With this setup, you can do everything you need from the local command line.

How do you do this? I’m glad you asked. What I’m going to do is walk you through the process of creating a new remote repository on GitHub and then creating a local repository on your desktop machine and connect the two. This is very basic Git/GitHub stuff, so if you’re already up to speed on how this works move along as there’s nothing for you here.

However, if you’re new to Git/GitHub, keep reading, as this is something you’ll be using quite a lot in your future as a developer.

SEE: VPN usage policy (TechRepublic Premium)

What you’ll need

The first thing you’ll need is a GitHub account, so head over and sign up. You’ll also need git installed on your platform of choice. I’ll be demonstrating with Ubuntu Server 18.04, but the operating system doesn’t matter, so long as it supports Git.

How to create a new repository on GitHub

The first thing to be done is the creation of a new repository on GitHub. Log in to your GitHub account and go to the Dashboard. From that page click the Repositories tab. In this new window, click New (Figure A).

Figure A

The repository tab in GitHub.

In the resulting window, give the project a name and an optional description (Figure B). Depending on what this project is used for, you might make it private.

Figure B

Creating a new repository on GitHub.

Click Create Repository and GitHub will do it’s thing. The address of the new repository will be:

https://github.com/USER/PROJECTNAME.git​

Where USER is your GitHub username and PROJECTNAME is the name you gave your new project. You’ll need that address in a bit.

How to connect your local project

Now the fun begins. On your local machine, create a new project folder with the command:

mkdir myproject

Change into that newly-created directory with the command:

cd myproject

Initialize the repository with the command:

git init

Now let’s create a readme file with the command:

touch readme.txt

Add the new file to the staging area with the command:

git add .

Now we’re going to create our first commit. If you’re not sure what a commit is, it’s simple: A commit adds the latest changes to the source code to the newly-created repository. These changes will then be part of the head revision of the repository.

To create the commit, issue the command:

git commit -m "added readme"

You can change the text in quotes to be whatever you want, such as “my first commit.” Make sure the text in quotes describes what’s been done for the commit.

The next step will make use of the GitHub repository address. What we need to do is add the local repository to the origin (the name of the remote repository where you want to publish your commits) of the remote repository. This is done with the command:

git remote add origin https://github.com/USER/PROJECTNAME.git

Where USER is your GitHub username and PROJECTNAME is the name you gave your new project. 

At this point you can then push your work to the remote with the command:

git push -u origin master

When you run this command, you’ll be asked for your GitHub username, followed by your GitHub user password. Upon successful authentication, your local repository will be connected to the remote GitHub repository and the readme.txt file pushed to the remote.

Let’s add another file and push it to the remote repository. Issue the command:

touch LICENSE

Add the file to the staging area with the command:

git add .

Issue a new commit with the command:

git commit -m "added license file"

Push the changes to the master branch of the GitHub repository with the command:

git push -u origin master

Now, if you look at the repository on GitHub, you’ll see both the readme.txt and the LICENSE files are there (Figure C).

Figure C

We’ve successfully pushed our files to the remote GitHub repository.

Congratulations, you’ve just pushed a new project to GitHub from the command line. Yes, this is very basic stuff, but it’s a task you’ll need to understand as you embark on a career as a developer. Make sure you are well-versed in Git and GitHub, so your path toward developer nirvana is as clear as possible.

http://www.techrepublic.com/

Developer Essentials Newsletter

From the hottest programming languages to the jobs with the highest salaries, get the developer news and tips you need to know.
Weekly



Sign up today

Also see

How to shift from a project to a product mindset

how-to-shift-from-a-project-to-a-product-mindset

Many technology leaders are shifting from executing projects, to launching IT products. Here’s why this could be a major benefit to your organization.

Image: scyther5, Getty Images/iStockphoto

IT will never be accused of being short on buzzwords. Just when you thought you’d mastered “digital transformation,” many IT leaders are now talking about shifting from projects, to products. At first, it may seem like this is a semantic game, applying a fancy new term to a hackneyed idea, but done right, thinking in terms of products can be a game changer for your organization.

SEE: Return to work: What the new normal will look like post-pandemic (free PDF) (TechRepublic)

If a project delivers without anyone to hear it, does it really make a sound?

For years, IT leaders were admonished that the key to winning the hearts and minds of colleagues was successfully executing strategic projects. There’s nothing fundamentally wrong with the idea that being able to consistently deliver projects that advance the organization’s strategy is a very good thing indeed. The challenge at many IT shops and  organizations is that most have become quite good at the “consistent delivery” part of the equation, but still struggle with the “advancing the organization’s strategy” piece.

SEE: Inside UPS: The logistics company’s never-ending digital transformation (free PDF) (TechRepublic)

Like the unobserved falling tree in the woods, at many organizations good people assemble to implement great technology, on-time and on-budget, but end up having little or no organizational impact. Like the tree falling unheard, the project that fails to create any meaningful change and becomes a non-event, causing outsiders to wonder if it ever occurred at all. IT leaders are then left having invested time and resources in something that essentially went unnoticed.

The keys to a successful product

While the challenges of the “successful failure” may be relatively new to IT organizations that have spent years perfecting their delivery chops, they’re old hat in the product delivery space. You can likely name a dozen products that were successfully delivered to the market but ultimately panned by consumers. Countless vehicles, consumer electronics, and digital offerings were delivered on-time and on-budget, but failed to understand their intended customers, communicate with those customers, or deliver the set of features and functions that the market wanted. In some cases, well-executed product launches missed changing customer tastes and launched a product built for yesterday that failed today.

SEE: The new SMB stack (free PDF) (TechRepublic)

These are hard and costly lessons, and most product organizations now spend weeks or months trying to understand whether their product makes sense in the market, and performing countless tests to validate demand before the first line of code is committed, or the first weld performed. With demand validated, they’ll spend additional time trying to understand the right combination of features and functions, and how they can best be packaged so that they’re compelling enough to customers to get them to click the Buy button, even when the initial price is free.

Contrast that to a typical project delivery, where the initial focus is around delivery methodology, project management tools, and organizational and governance models. All important considerations, but the best tools, leaders, and approaches will not turn the wrong product into the right one. Just because someone has allocated funding to a program doesn’t mean that they’ve thought through whether the program is actually relevant.

How to apply a product mindset

The simple shift from “how” you’ll deliver, to what you’ll deliver and how to make it relevant to the intended audience can change the game for how you deliver your programs. Starting with getting a deeper understanding of who your program impacts, what’s important to them, and how you’ll inform them of your brilliant new offering will position you for success, assuming you’ve got your delivery chops down.

If you believe this is all fluff or you’ve got this down, at your next status meeting, amid the discussions of WBS elements and completion percentages, ask someone why a user will engage with that particular function. After some stammering and blank stares, you’ll likely get a half-coherent answer about “change management,” which is shorthand for “I’m assuming that’s someone else’s problem.”

SEE: Life after lockdown: Your office job will never be the same–here’s what to expect (cover story PDF) (TechRepublic)

Too many IT teams follow what I’ve termed the Field of Dreams approach, following a disembodied voice that keeps repeating, “If you build it, they will come.” While it might work for baseball fields and ghostly apparitions, there are too many alternatives, including shadow IT, to bet your success on this “strategy.”

Push your teams to answer hard questions about who will use your product, and how they’ll benefit, just as you would if you were tasked with launching a new car, smartphone, or snack food. The discussions will be awkward at first, but they’ll make for a much better end result.

Executive Briefing Newsletter

Discover the secrets to IT leadership success with these tips on project management, budgets, and dealing with day-to-day challenges.
Delivered Tuesdays and Thursdays



Sign up today

Also see

This project is using fitness trackers and AI to monitor workers’ lockdown stress

this-project-is-using-fitness-trackers-and-ai-to-monitor-workers’-lockdown-stress

Times are tough and employee wellbeing is more important than ever. PwC is harnessing AI and fitness-tracking wearables to gain a deeper understanding of how work and external stressors are impacting employees’ state of mind.

Employee wellbeing has become a central focus for businesses during the COVID-19 crisis, with the pandemic putting the spotlight on the need to promote healthy working habits and ensure staff are provided with
the support they need
to maintain good mental health while working far from the office and colleagues.

While many companies may have attempted nothing more sophisticated than regular team catch-ups on Zoom to keep an eye on things, some have turned to more novel approaches to gain insight into
how staff are faring
during difficult times.

SEE: Managing AI and ML in the enterprise 2020: Tech leaders increase project development and implementation (TechRepublic Premium)  

For the past three weeks, professional services firm PwC has been running a pilot scheme that combines machine learning with wearable devices to understand how lifestyle habits and external factors are impacting staff. The project involves volunteers using fitness trackers that collect biometric data around the clock which, when combined with a series of cognitive and biometric tests and fed through an AI algorithm, aims to help staff better manage stress.

The key to this initiative is observing how factors such as sleep, exercise and work diary load play a part in how PwC staff perform at work. Eventually, it is hoped workers will gain a better understanding of how they can structure their approach to work and home life in a way that benefits their
mental health
and wellbeing.

It’s a theme that resounds with many of us currently, which perhaps explains why the initiative has proved so popular with PwC employees: the company saw 2,000 applicants sign up within four hours of posting the project on its internal intranet for a trial with only 1,000 spaces.

“I think if we went higher profile, we could have had a multiple of that number, which starts to get up to a pretty high percentage of the organization in the UK,” says Euan Cameron, PwC’s UK artificial intelligence lead.

“What is says to me – and it’s really the first learning from the exercise – is that there’s really no shortage of interest… we would never do this if an organization tried to compel people to do this. I think you’d be in different territory, frankly.”

The pilot scheme at PwC came about following discussions between Cameron and associates at IHP Analytics, a boutique analytics firm that specializes in human performance in elite sports. The firm, which has worked alongside professionals in Formula 1 racing and Olympic cycling, is aiding the development of the underlying platform, which it eventually hopes to offer to external clients.

“One of the areas, even before COVID, that we knew was developing fast was a deeper understanding of human performance and human wellness,” Cameron says. “We want to marry these two together to do something positive for our people.”

Vicki Broadhurst, a senior manager at PwC, volunteered for the trial in order to help her understand how her physical activity linked to her cognitive performance and how she felt.

She tells TechRepublic that her participation in the trial stemmed from her own interest in the role of artificial intelligence in psychometric testing, as well as wanting to remain active during lockdown.

“I wanted to take part in something that would challenge me to be more active whilst I was at home all the time, as well as give me targets to work towards,” she says.

“As a morning person, it’s made me realize that if I don’t get my steps in early in the day I’m less likely to do them later. This means that I now structure my day around regular early breaks to do exercise, which makes me much more productive overall.”

Crucial to the fitness tracker – a Garmin Vivosmart 4, in this instance – is that it can capture heart rate variability, or HRV. Cameron refers to this as “the Rosetta Stone” in biometrics, insofar as it is able to record changes in the wearer’s pulse rate associated to stress, energy and recovery – “which is really important for what we’re looking at here,” he says.

In addition to wearing the fitness tracker 24/7 (Cameron stresses that participants are allowed to take them off to shower), employees are asked to perform a series of cognitive tests, either delivered via online games or short questionnaires.

Performed daily, these 10-minute assessments have been designed to evaluate individuals’ short-term memory, concentration, and task-switching ability, to help them understand how on the ball they are, from a cognitive point of view, each day.

This is combined with a one-off set of more in-depth baseline tests, which aims to provide insight into “some deeper personality traits”, Cameron explains, including risk appetite and working preferences.

SEE: Guide to Becoming a Digital Transformation Champion (TechRepublic Premium)

Finally there’s the contextual data. This looks at factors such as how heavy an individual’s workload is on any given day, how many hours they’re working, and even their home working environment: “How fast is your broadband, have you got a dedicated space where you can work, are your kids at home, things like that,” says Cameron.

“It’s quite a rich dataset, which will help us understand what’s driving performance at an aggregated level. But primarily, [it’s] to help individuals understand a little bit more about their mental and physical response to the world of work, and the different stimuli that exist.”

This in turn provides an opportunity to learn “something about how we cope as individuals, and as an organization,” says Cameron.

Cameron isn’t in a position to share any data insights from the trial yet – it’s early days, after all – and the data needs to be “stress-tested, poked and prodded,” he says. However, he does suggest that early insights point to an “inflection in energy and stress levels” when staff have more than seven appointments in a day.

For Broadhurst, the most interesting insights have been those into her sleeping patterns, as well as the more subtle nudges the smartwatch delivers to encourage her to move around or stay hydrated.

“Stress levels are not something that I have been particularly focused on as I am generally quite a relaxed and calm person,” she explains.

“I’m more interested in things like my sleep patterns, and the device can help with that as it breaks them down to light sleep, REM sleep and deep sleep. I discovered that I’m getting more sleep in general than before, but not as much deep sleep.

“I have also done some baseline cognitive tests, and we should get the results soon, which I’m looking forward to.”

Equally interesting for Cameron is the variation in individuals who underestimate or overestimate their stress levels, accordingly. “Some people are exceptionally good at being in-tune with their bodily response, whereas other people who find it quite difficult,” he says.

“It’s prompted me to look at alternative ways to manage my energy levels, manage my stress levels and think about relaxation, other than sleep and exercise outlets. I think a lot of the benefit of this from an organization… comes from a thousand small changes that come from the grass roots, on the basis of the information and insight you put in peoples’ hands.”

Data, Analytics and AI Newsletter

Learn the latest news and best practices about data science, big data analytics, and artificial intelligence.
Delivered Mondays



Sign up today

Also see