Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-25-2015, 02:46 AM   #1
Registered: Nov 2011
Posts: 63

Rep: Reputation: Disabled
Git from 2 repository with different gitignore

I pull a repository from a person and I want to push to my own repository because something change and I want to use different gitignore file. How can I do it? Thanks, and I want to use github and bitbucket both. Then is it possible. Thanks.
Old 01-25-2015, 12:32 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
It's definitely possible - you'll just have to set up two different remotes: one for gitlab and one for bitbucket. However, having two different .gitignore files is going to be somewhat tricky. I've never found a good way to do that. The best way might be to create two different branches in your clone (one with bitbucket as the origin and one with GitHub). These two branches can have different .gitignore files. The problem will be making sure changes to the .gitignore files are not overwritten when merging between the two branches. However, you can always revert any changes to .gitignore after merging.

There may be an easier way to do this, but if so I have yet to find it. Why do you need two different .gitignores? I presume you want to keep some files out of one or the other remote, but for what purpose?
Old 01-25-2015, 07:43 PM   #3
Registered: Nov 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
Originally Posted by btmiller View Post
It's definitely possible -.....?
Acutally, I use one person's emacs configuration and of course I add some plugins for my own. In his configuration, there are many files ignored. But I just want to push all things to my own repositary. And I am afraid when I pull from his configuration when he updated, it might overwrite the .gitignore. That is the reason.
Old 01-26-2015, 01:55 AM   #4
LQ Guru
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,453

Rep: Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777
I have never tried, but probably you can put .gitignore itself into .gitignore and you will have your own private copy. Other solution can be to use symbolic link instead of file, pointing outside of the repo.
1 members found this post helpful.


git, multiple, repository

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
git repository akhilesh_03 Linux - Newbie 1 08-12-2014 01:01 AM
Can't push to Git Repository NotionCommotion Linux - Newbie 4 04-20-2014 10:48 PM
gitolite-admin does not appear to be a Git repository Hamed Programming 2 01-18-2012 02:32 PM
configuring git public repository geetha_sg Linux - General 0 09-11-2008 11:30 PM
Linux git repository help needed TheDirtyScreech Linux - General 13 08-09-2007 09:56 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration