Pull from one GitLab repository and push into another one - intellij-idea

So I have a public repository from my lecturer on GitLab, which I cloned into intellij via "import VCS" (https Link). Now I want to always push into my own repository in GitLab and not the public repository. How can i do this in intellij or where else can I set this up?
I already tried to copy the project into a new project and push seperately but this isnt a good solution because then i need to copy everything manually whenever new things are being added in the public repository and i cant just pull from the public repository.
The optimal solution would be, that i can pull from the public repository but push my commits into my own repository in GitLab

clone the public repository using command
git clone repo_path
git add .
git commit -m "comment"
git push origin main

You can clone your lecturer project.
Once it's done, go to Git | Manage remotes and add your private repostiory there.
Once it is added there, when you decide to Push -> go to Git | Push and then you can click on origin and choose desired remote. This way you can choose your target remote and update your local project from your teacher's repository.

Related

first time check in my pycharm project to Git

I have written whole code before cloning any repo, now I decided to push entire code into new repo directly from pycharm IDE.
Do anyone know how to do that.
If you want to push the project to GitHub, just use VCS - Import into Version control - Share on GitHub.
If you want to push somewhere else, then:
Use VCS - Enable VCS integration. If there is no git repository in
the project, IDE will create one.
Mark all files you need, add them to git and commit
Add a remote using VCS - Git - Remotes
Push (VCS - Git - Push, or Ctrl+Shift+K)
first check your remote by git remote -v
add remote of new repo while creating repo you will get.
git remote add origin
git init
git add .
git commit -m "first initialize"
git push origin master

Branch my own repo in a separate folder - GitHub for Windows

I need to work on different branches of a project at the same time, so having multiple folders (one for each branch) would be the faster and easier solution.
The problem arises when cloning my own repo: GitHub for Windows will recognize it and automatically move it to the main repository, where i can manage only one branch at a time.
I'm new to GitHub and couldn't find any working solution/workaround for version 1.2.110
Already tried, didn't work:
Github: how to checkout my own repository
Clone Github repo to specific Windows folder?
https://stackoverflow.com/a/7803102/1193335
http://bitdrift.com/post/4534738938/fork-your-own-project-on-github
1 Create a new folder, eg: C:\GitHub\mynewbranch
2 Drag it into GitHub, fill the description fields, uncheck "Push to GitHub" and continue.
3 Open your "Repository settings":
And fill the "Primary remote (origin)" field with your repository url:
4 Click "Open in Git Shell" (below "Repository settings") and type this in the command line:
git remote set-url origin git#github.com:<username>/<repository name>.git
5 Then this:
git pull origin <branch name>
6 Switch to the desired branch in GitHub, enjoy :-)
P.S. to update future changes from the master:
git pull origin master

how to migrate project with whole history into another bzr repository?

I have old bazaar repository; now I want to migrate some projects with whole commit history from it into particular nodes in new repository.
How can I do this?
Well, simply push each project checkout to the new repository.
Get your project1 (optional if you already have a local copy)
bzr branch bzr://Path/to/my/Project1
and then push it to the new repository.
bzr push bzr://Path/to/my/new/repository/particular/node/Project1
You can import your project inside a repository (or shared repository) where you want. I assume that's the 'nodes' you speak about ?
Push reference help:
http://doc.bazaar.canonical.com/bzr.2.5/en/user-reference/push-help.html

How to set tracking on an existing repo to a remote repo with ngit (or jgit)?

I am working on a gui based helper utility that will:
Init a local repo, Init (bare) a remote repo
Add .gitignore based on a project type
Commit all the files locally
Add a remote repo to the local config
Push master to the remote repo
Create a develop branch and push it to master
All this is done without git installed by using ngit (.NET port of jgit).
But I can't figure out how to setup tracking to track master to origin/master and develop to origin/develop using just ngit.
I can do it easily with
git branch --set-upstream master origin/master
However, I was hoping to avoid the dependency of a local git install.
Here is a Java snippet that corresponds to the --set-upstream option to git branch:
Git git = Git.open(new File("/home/repos/myrepo"));
CreateBranchCommand create = git.branchCreate();
create.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
create.setName("develop");
create.setStartPoint("origin/develop");
create.call();

Using Github & Unfuddle at the same time

Is there a way to use Github and Unfuddle for the same repo? I am responsible for a repo hosted at Unfuddle, but I am not the main owner and it's private because it's part of an ongoing project. I still need to update the repo there when changes are made, but I would like to use the same set of files to create and update a public Github repo associated with my own account, is that possible? The reason I want to use the same files is that it's a WordPress plugin and it needs to be tested before I commit changes, therefore I need to use one set of files to not complicate the matter. Any help would be appreciated.
You can set up both the repositories as remotes and push/pull to and from both of them; Git is decentralized and thus doesn't really care about whether you have one remote or many.
http://www.kernel.org/pub/software/scm/git/docs/git-remote.html
Example:
git remote add github git#github.com:username/reponame.git
and then...
git push github <branchname>
git pull github
git log github/<branchname>
etc...
Create your github repository, then from your Unfuddle local repository, run:
git remote add github git#github.com:YourUsername/YourReponame.git
Where YourUsername is your github user name, and YourRepository is your repository name. After setting up the github repository, the above URL with the user name and repository name filled in, should appear on your github repository page anyway.
Everything works like you'd expect, for example, pushing:
git push github
Your settings for the Unfuddle repository will work like before.