How to upload a project to a repository different from the one that was cloned?

1

I have a project to clone from a git repository, now I want to upload it to my github account to work it from there, the question is: how do I upload it to a new git server? I tried to add it but it always redirects me to the old server

    
asked by noe 16.12.2017 в 02:42
source

3 answers

1

First delete the .git directory:

rm -rf .git

Then initialize a new repository:

git init
git add .
git commit -m 'mensaje a enviar'
git push URL /*del repositorio donde va ha enviar; para mi caso era uno de GitHub*/
    
answered by 08.02.2018 / 18:00
source
1

Removing the remote from the cloned repository should be enough.

Do:

git remote remove origin

For clients with git 1.7.10 and earlier:

git remote rm origin

And then you add the new remote:

git remote add origin https://tunuevoremote.com/repo.git

You can also avoid having to delete and add by simply changing the URL of the remote:

git remote set-url origin https://tunuevoremote.com/repo.git

Then you execute the traditional steps to make push your changes and see them in the new remote.

Although it is always good to fork the repository.

Taken from here

And you should be fine.

    
answered by 05.01.2018 в 22:25
0

Suppose you cloned jQuery:

git clone https://github.com/jquery/jquery.git

Then on github create your own repo and stayed in

https://github.com/noe/jquery_reloaded

In your place you have to change the remote to point to your repo:

git remote --set-url origin https://github.com/noe/jquery_reloaded.git

And from then on when you do push you'll be working with your repo

    
answered by 19.12.2017 в 13:37