Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pushing to a private repo

Tags:

git

github

push

I have been working on my local on a web app and I was ask to push it to an empty(only read me file on it) private repo created just for this project. I'm new to git and I'm having trouble doing so.

Can someone tell me what am I doing wrong?

I first navigate to the main folder of the app in my local using command line and initialize git. After, I try cloning the remote repo with:

git clone git://github.com/somename/Web-App.git 

but I get the error:

Cloning into 'Web-App'... fatal: remote error: Repository not found.

I know the repo is there.. Do I actually need to clone or pull from that remote first or is there a way to just push to that repo.

Again, all I'm trying to do is to get the files that I have in my local pushed to a specific repo that I was given access to.

I will really appreciate any help.

like image 761
irm Avatar asked Sep 17 '13 05:09

irm


People also ask

Can you push to private repo?

To push to a private repository, you probably want to fork it, push your changes to your copy (which will stay private), and then create a pull request.

How do I push to a specific repo?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.

Can you link to a private GitHub repository?

There is no way to share private repository among non-Github users. You need the Github account and be added as collaborator to the project.


1 Answers

Let us say 'yourWebApp' is the folder you have your local web app. Change it to the directory

cd 'yourWebApp' 

Init git in the folder

git init 

Now add your github url as a remote

git remote add origin git://github.com/somename/Web-App.git 

Here origin is the short name for your url

Now pull the read me file from the github repo

 git pull origin master 

Now push your web app to the github repository

git push origin master 

Here it is assumed that you are in your master, the default branch

Here pulling your readme files is necessary to merge the readme file with your local work. If your github repository is empty, you can skip the pull and directly push to your github repository.

On the other hand, if you want to use clone, there is no need to init as clone automatically sets up git in the directory. clone also sets your remote git url. In that case, your workflow should be

 git clone https://github.com/path/to/your/repo  make some changes  git add your changes  git commit your changes  git push 
like image 62
palerdot Avatar answered Oct 24 '22 03:10

palerdot